TypeError: new() received an invalid combination of arguments-got(float, int)
程序员文章站
2022-05-27 12:40:17
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zhangboshen/anaconda3/lib/python3.6/site-packages/torch/nn/modules/linear.py", line 48, 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:
* (torch.device device)
* (torch.Storage storage)
* (Tensor other)
* (tuple of ints size, torch.device device)
didn't match because some of the arguments have invalid types: (float, int)
* (object data, torch.device device)
didn't match because some of the arguments have invalid types: (float, int)
这个问题确实是由于‘/’的问题,需要将其换成‘//’,但也要注意换成之后,也就是取整,会破坏原来的结构。
上一篇: PHP-CGI 进程 CPU 100% 与 file
下一篇: python 随机数
推荐阅读
-
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, )