欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

TypeError: new() received an invalid combination of arguments - got (float, int), but expected one

程序员文章站 2022-03-18 19:47:33
...
File "/source/*************/model.py", line 900, in __init__
    self.decoder = AttentionDecoder(hidden_size, nclass, dropout_p, max_length)
  File "/source/*************/model.py", line 873, in __init__
    self.attn = nn.Linear(self.hidden_size*2, self.max_length)
  File "/home/*************/torch/nn/modules/linear.py", line 72, in __init__
    self.weight = Parameter(torch.Tensor(out_features, in_features))
TypeError: new() received an invalid combination of arguments - got (float, int), but expected one of:

解决:

self.max_width = self.image_width/4 + 1 

改为:

self.max_width = self.image_width//4 + 1 
相关标签: 填坑之旅