I can't find a reference documentation for the gradient function of Julia Flux, there are only several tutorial examples.
I understand how gradient is used to compute gradients of functions, e.g. the syntax
f(x, y) = x^2 + y^2
df(x, y) = gradient(f, x, y)
will essentially yield df(x, y) = (2x, 2y). However later the tutorial uses the following syntax without any explanation:
gs = gradient(() -> loss(x, y), Flux.params(W, b))
I think there are ways to interpret a gradient of () -> loss(x, y) from the math point of view, but I am not sure that this is what is going on here. So what is this anonymous function and why was gradient designed that way? A link to the full documentation of gradient would be appreciated.