-
Notifications
You must be signed in to change notification settings - Fork 436
tangent.grad_dot fails with (3,) (3,) arguments #59
Comments
Do you have the original code and arguments you used for gradients? A possible cause might be that |
import tangent
import numpy as np
def test(x, y):
return np.dot(x, y)
xxx = tangent.grad(test)
xxx(np.random.rand(1, 3), np.random.rand(1, 3)) |
I see - the error originates from For example, the following code fails with the same error:
That said, I think it would be useful to wrap errors and more clearly indicate when an error originates in the forward code. |
Oh right, sorry. Well you can still make it work with numpy but fail with tangent even though it becomes a different error now import tangent
import numpy as np
def test(x, y):
return np.dot(x[0, :], y[0, :])
test(np.random.rand(1, 3), np.random.rand(1, 3)) #runs
xxx = tangent.grad(test) # doesnt
xxx(np.random.rand(1, 3), np.random.rand(1, 3)) |
Yes, it seems that we have a bug in the handling of slice operators. This might be insufficient for your immediate needs, but it should run:
Alternatively, you could use
|
Opened #62 for the slice issue. |
Once I produce my gradient function with
tangent.grad
, calling the function fails with the following errorHad to do:
np.dot(x[jj], np.reshape(x[kk], (-1, 1)))
to fix it. Not a huge issue but it could confuse users.The text was updated successfully, but these errors were encountered: