Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
import torch
import jovian
import numpy as np
t1 = torch.tensor([1, 2, 3])
a = torch.is_tensor(t1)
a
True
t1.numpy()
a = torch.is_tensor(t1)
a
True
a = torch.is_tensor(t1, 56)
a
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-8524801e99e3> in <module>
----> 1 a = torch.is_tensor(t1, 56)
2 a
TypeError: is_tensor() takes 1 positional argument but 2 were given
t2 = torch.randn(5, out=None, dtype=None, layout=torch.strided, device=None, requires_grad=False)
t2
tensor([ 2.6448, 0.3247, -0.0756, -0.3509, 1.0194])