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)
这个问题确实是由于‘/’的问题,需要将其换成‘//’,但也要注意换成之后,也就是取整,会破坏原来的结构。