pytorch中int和float如何进行转化?

优先使用:**torch.tensor(已有数据,dtype=torch.float)**这个方法比较好
可以看例子。这也可以反向运行。

实际上torch.FloatTensor()的输入最好是列表等,而不是一个数字。

 参考:

https://blog.csdn.net/qq_27261889/article/details/103186904

猜你喜欢

转载自blog.csdn.net/l641208111/article/details/121524356