我能够将 pytorch 模型参数转换为 float 或 double,但不能转换为 long。
model = model.long()
给出错误,而
model = model.float()
运行。
我得到的错误是:
'Net' object has no attribute 'long'
最佳答案
大多数 nn
模块不支持长(整数)运算,例如卷积、线性层等。因此,您无法将模型“转换”为 torch.long
.
关于machine-learning - 如何将Pytorch模型参数转换为长数据类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56921455/