prepare_gradient doesn't work when the first argument of f is either Constant or Cache.
function my_f(a, x)
return a * sum(abs2, x)
end
function my_f2(x, a)
return a * sum(abs2, x)
end
a = 0.1
x = rand(100)
backend = AutoMooncake(; config=nothing)
prep = prepare_gradient(my_f, backend, Constant(a), x) # doesn't work
prep2 = prepare_gradient(my_f2, backend, x, Constant(a)) # works