Open vaithak opened 2 months ago
That is a feature, not a bug because often (in case of ROOT) we were told that is is with accumulating especially for vector values functions…
I agree it looks like a bug but I am not sure how we can improve the situation. Maybe clarify in the documentation?
That is a feature, not a bug because often (in case of ROOT) we were told that is is with accumulating especially for vector values functions…
I don't mind the accumulation, but the accumulation seems to be happening incorrectly in the second case.
Python frameworks like Pytorch accumulate too, until you call .zero_grad
method (or something similar), but the accumulation result seems to be incorrect here.
Ok, sorry I missed that part!
Function 1:
Function 2:
Both the functions are essentially doing
f(x) = -x
, so thedf/dx = -1
. If we don't zero out the derivative parameter when passing to the.execute
method, the expectation is that it will accumulate the result, i.e._d_param += dfdx
. Doing so for the above functions results in different outputs. Code for reproducing the issue:Outputs: