pytorch改变tensor的类型

假设变量名为ts

方法一:

ts=ts.double()
ts=ts.long()

方法二:

ts=ts.type(torch.DoubleTensor())
ts=ts.type(torch.LongTensor())

猜你喜欢

转载自blog.csdn.net/dlhlSC/article/details/88102698