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
Hi,
I would like to know how to perform operations on scalar tensors. For example, the following code fails
t = np.array([1, 2, 3])
a = np.array([4, 4, 4])
a.attach_grad()
with mx.autograd.record():
b = 2.0 * np.dot(a, t)
db = mx.autograd.grad(b, [a])
print(db)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi,
I would like to know how to perform operations on scalar tensors. For example, the following code fails
with the following error
The reason is that I am multiplying np.dot(a, t), which is a zero-dimensional array, with a number.
What is the correct way to do that?
Thank you.
All reactions