知识点
import torch
x = torch.Tensor([1, 2, 3, 4])
print('-' * 50)
print(x)
print(x.size())
print(x.dim())
print(x.numpy())
print('-' * 50)
print(torch.unsqueeze(x, 0))
print(torch.unsqueeze(x, 0).size())
print(torch.unsqueeze(x, 0).dim())
print(torch.unsqueeze(x, 0).numpy())
print('-' * 50)
print(torch.unsqueeze(x, 1))
print(torch.unsqueeze(x, 1).size())
print(torch.unsqueeze(x, 1).dim())
print('-' * 50)
print(torch.unsqueeze(x, -1))
print(torch.unsqueeze(x, -1).size())
print(torch.unsqueeze(x, -1).dim())
print('-' * 50)
print(torch.unsqueeze(x, -2))
print(torch.unsqueeze(x, -2).size())
print(torch.unsqueeze(x, -2).dim())