1.拼写错误
super.__init__()
Traceback (most recent call last):
File "D:\code\pythonProject2023\pytorch\CNN.py", line 47, in <module>
model = CNN_simple()
File "D:\code\pythonProject2023\pytorch\CNN.py", line 27, in __init__
super.__init__()
TypeError: descriptor '__init__' of 'super' object needs an argument
改为
super().__init__()
2.存在多个拼写问题,不详述
在Python中,使用super()调用父类构造方法时出现了一个TypeError。问题出在拼写上,应当使用super().__init__()而不是super.__init__()。修正这个错误后,代码能正确执行。此外,文章还提及了可能存在的其他拼写问题。
293





