tensor张量有不同的数据类型,例如torch.long,torch.float32,torch.float16等之间可以相互转化
import torch
x = torch.zeros([2,2])
x = x.to(torch.long)
x = x.to (torch.float32)
tensor张量有不同的数据类型,例如torch.long,torch.float32,torch.float16等之间可以相互转化
import torch
x = torch.zeros([2,2])
x = x.to(torch.long)
x = x.to (torch.float32)