Created
December 12, 2019 09:28
-
-
Save nithyadurai87/79d938591a3ddf6d2234dc54c441082c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
x1 = torch.Tensor() | |
print (x1) | |
x2 = torch.Tensor([1,2,3]) | |
print (x2) | |
print (x2.size()) | |
print (x2.dtype) | |
x3 = torch.tensor([1,2,3]) | |
x4 = torch.as_tensor([1,2,3]) | |
print (x3) | |
print (x4) | |
print (x3+x4) | |
#print (x2+x3) | |
print (x4.dtype) | |
print (x4.device) | |
print (x4.layout) | |
print (torch.eye(2)) | |
print (torch.zeros(2,2)) | |
print (torch.ones(2,2)) | |
print (torch.rand(2)) | |
print (torch.rand(2,3)) | |
print (torch.rand(2,3,4)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment