on-internet
← Community

Unable to create a tensor using torch.Tensor

Stack Overflow ·

i was trying to create a tensor as below. import torch t = torch.tensor(2,3) i got the following error. TypeError Traceback (most recent call last) in () ----> 1 a=torch.tensor(2,3) TypeError: tensor() takes 1 positional argument but 2 were given so, i tried the following import torch t = torch.Tensor(2,3) # No error while creating the tensor # When i print i get an error print(t) i get the following error RuntimeError Traceback (most recent call last) in () ----> 1 print(a) D:\softwares\anaconda\lib\site-packages\torch\tensor.py in repr(self) 55 # characters to replace unicode characters with

Comments

Sign in or sign up to comment and upvote.

No comments yet.