pytorch: Tensor 常用操作
pytorch: Tensor 常用操作 torch.tensor是一个包含多个同类数据类型数据的多维矩阵。 常用参数 dtype : tessor的数据类型,总共有八种数据类型。其中默认的类型是 torch.FloatTensor ,而且这种类型的别名也可以写作 torch.Tensor 。 Data type dtype CPU tensor GPU tensor 32-bit floating point torch.float32 or torch.float torch.FloatTensor torch.cuda.FloatTensor 64-bit floating point torch.float64 or torch.double torch.DoubleTensor torch.cuda.DoubleTensor 16-bit floating point torch.float16 or torch.half torch.HalfTensor torch.cuda.HalfTensor 8-bit integer (unsigned) torch.uint8 torch.ByteTensor torch.cuda.ByteTensor 8-bit integer (signed) torch.int8 torch.CharTensor torch.cuda