pytorch中有torch.float32等的数据类型,主要的对应关系及转化有:
short————————torch.int16
转化:tensor.short()或tensor.type(torch.int16)
int—————————torch.int32
转化:tensor.int()或tensor.type(torch.int32)
long————————torch.int64
转化:tensor.long()或tensor.type(torch.int64)
float————————torch.float32
转化:tensor.float()或tensor.type(torch.float32)
douboe——————torch.float64
转化:tensor.double()或tensor.type(torch.float64)