Open ForceBru opened 1 year ago
Hi, I had the same problem and I think you're right. Especially because when replacing the last line in your code by
autograd.grad(lambda x: cs.dot(x))(x)
(i.e, just swapping x
and cs
in the function definition) it works as expected.
I do think that 'dot'
should be added to the diff_methods
, but in the meantime my fix was to just replace the dot
by the numpy @
operator. That works in any case.
Looks like
ArrayBox
has not attributedot
, so I can't differentiatex.dot(y)
wrtx
:I managed to fix this by adding
'dot'
todiff_methods
here: https://github.com/HIPS/autograd/blob/e18f656118d23982bacf33380da3efc09b62cfe3/autograd/numpy/numpy_boxes.py#L56-L64Now the error is gone and my code seems to produce correct results. According to NumPy,
numpy.dot
is the equivalent function for thenumpy.ndarray.dot
method, so this also seems to align with what the comment says.Should
'dot'
indeed be added todiff_methods
, or is this expected behavior?