Here is a code example
X = rand(3,3) .- 0.4
X = X |> cu
f(X) = sum(ifelse.(X .> 0, X, 1f0))
gradient(f, X)
And here is the error message
ERROR: TypeError: non-boolean (ForwardDiff.Dual{Nothing,Bool,3}) used in boolean context
If X
is a CPU array, then it works fine, but not when X
is a CuArray
.
Any suggestion on fixing the issue?
Thanks