I'm trying to use the relu function on a matrix in MATLAB, and am calling it as A = relu(A)
, but I keep getting the error
Incorrect number or types of inputs or outputs for function relu.
I tried it on a scalar as well, and also get the same error. What could be causing this?
In MATLAB, relu
is a method of dlarray
. So you need to pass in a dlarray
instance as input, like this:
out = relu(dlarray(1)) % or whatever value you wish