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
推荐阅读
-
TypeError: new() received an invalid combination of arguments-got(float, int)
-
TypeError: new() received an invalid combination of arguments - got (float, int, int, int), but expe
-
TypeError: sum() received an invalid combination of arguments - got (axis=int, ), but expected one
-
TypeError: transpose() received an invalid combination of arguments - got (int, int, int, int), but
-
TypeError: new() received an invalid combination of arguments - got (float, int), but expected one
-
numpy矩阵求和 TypeError: sum() received an invalid combination of arguments - got (axis=int, )