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
We can transform the result into a scalar in Python using the asscalar function of numpy. In the following example, the $\ell_2$ norm of x yields a single element tensor. The final result is transformed into a scalar.
In[20]: np.asscalar(x.norm())
Out[20]: 22.494443893432617
Why don't just use x.norm().item() to get the scalar, which seems much easier? Are their any differences?
The text was updated successfully, but these errors were encountered:
in CH_4_Data_manipulation, we use
Why don't just use
x.norm().item()
to get the scalar, which seems much easier? Are their any differences?The text was updated successfully, but these errors were encountered: