torch.empty() fastest
shape = (2, 3, 4) x = torch.empty(shape) x = torch.empty(2, 3, 4)
torch.zeros()
shape = (2, 3, 4) x = torch.zeros(shape) x = torch.zeros(2, 3, 4)
torch.ones()
shape = (2, 3, 4) x = torch.ones(shape) x = torch.ones(2, 3, 4)
Copy
b = torch.empty_like(a) # same shape/dtype c = torch.zeros_like(a) # same shape with 0

Seonglae Cho