Learn practical skills, build real-world projects, and advance your career

WHAT IS PYTORCH

from __future__ import print_function
import torch
x = torch.empty(5,3)
print(x)
tensor([[1.0102e-38, 8.9082e-39, 8.4489e-39], [9.6429e-39, 8.4490e-39, 9.6429e-39], [9.2755e-39, 1.0286e-38, 9.0919e-39], [8.9082e-39, 9.2755e-39, 8.4490e-39], [9.4591e-39, 1.0653e-38, 9.0917e-39]])
x = torch.rand(5,3)
print(x)
tensor([[0.7805, 0.1753, 0.2189], [0.3482, 0.3434, 0.1846], [0.3932, 0.0728, 0.4450], [0.9930, 0.3409, 0.9641], [0.6693, 0.3998, 0.7048]])
x = torch.zeros(5,3,dtype=torch.long)
print(x)
tensor([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]])