You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
frompytensor.gradientimportjacobianimportpytensor.tensorasptx=pt.vector("x", shape=(3,))
y=pt.outer(x[1:], x[2:])
asserty.type.shape== (2, 1)
try:
jacobian(y, x)
exceptExceptionasexc:
print(exc) # jacobian expects a 1 dimensional variable as `expression`. If not use flatten to make it a vectorjac_y=jacobian(y.ravel(), x).reshape((*y.shape, *x.shape))
assertjac_y.type.shape== (2, 1, 3)
I don't see why we can't do the ravel -> reshape for the users? JAX accepts non-vector jacobian just fine.
The hessian is trickier as it requires also the combinations of the inputs?
The text was updated successfully, but these errors were encountered:
Description
I don't see why we can't do the ravel -> reshape for the users? JAX accepts non-vector jacobian just fine.
The hessian is trickier as it requires also the combinations of the inputs?
The text was updated successfully, but these errors were encountered: