TypeError: ‘int‘ object is not callable
程序员文章站
2022-03-18 19:47:21
...
数据加载的时候遇到TypeError: 'int' object is not callable
原因:数据不是Tensor类型的而是np.array或其他类型的。
print("pred.size(0)", pred.shape[0]) # np.array
#for batch_index in range(pred.size(0)): # tensor size()
pass
for batch_index in range(pred.shape[0]):
pass
#或者将pred转为tensor
上一篇: opencc
推荐阅读
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object.制作有道翻译小翻译软件的问题解决方法
-
解决报错:TypeError: argument should be integer or bytes-like object, not ‘str‘
-
编译安卓源码提示:TypeError: argument should be integer or bytes-like object, not ‘str‘
-
TypeError: The value of a feed cannot be a tf.Tensor object.几种情况
-
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type s
-
“TypeError: 'dict_keys' object is not subscriptable”