Numpy
随机矩阵: np.random.randn(d0, d1, d2, …)
矩阵大小与形状: np.ndarray.size 与 np.dnarray.shape
Pytorch
随机矩阵: torch.randn(d0, d1, d2, …)
添加维度: tensor.unsqueeze(0)
压缩维度: tensor.squeeze(0)
按维度拼接tensor: torch.cat(inputs, dim=0, …)
维度堆叠: torch.stack(inputs, dim=0