AttributeError: ‘function‘ object has no attribute ‘parameters‘

 

Possible Causes:

(1) The function name is the same as a name in the system, but this time there is no one named 'parametres'

(2) Import modul or function error

Actual reason:

模型加入了.cuda() is a function, so it cannot be directly optimized

solution: 

Remove .cuda and change to(device)

Mirroring problem:

AttributeError: 'Model' object has no attribute 'parameters'

 

 

Problem: torch.nn.model is not added to the init in the class

solution:

 

 

Guess you like

Origin blog.csdn.net/Viviane_2022/article/details/127798551