PyTorch 是当前最流行的深度学习框架之一。一切的基础都是 Tensor(张量)。

创建张量

python

import torch

创建一个 2x3 的随机张量

x = torch.rand(2, 3)

print(x)

查看形状

print(x.shape)