Python报错 TypeError: ‘int‘ object is not callable

Python报错 TypeError: 'int' object is not callable

Python报错 TypeError: ‘int‘ object is not callable_第1张图片

Python报错 TypeError: ‘int’ object is not callable
代码如下:
在这里插入图片描述

Python报错 TypeError: ‘int‘ object is not callable_第2张图片
因为预测的输出类型为numpy,但是criterion对象参数为torch类型。
修改代码:
在这里插入图片描述
传入参数类型改为torch类型,不再报错。

你可能感兴趣的:(Python报错,python)