TypeError: ‘method‘ object is not subscriptable 解决方法
x=tf.constant([2.1301,3.0102,3.3203])x=x.numpyfor i in range(3):print(round(x[i],2))运行报错:TypeErrorTraceback (most recent call last)in2 x=x.numpy3 for i in range(3):----> 4print(round(x[i],2))TypeEr
·
x=tf.constant([2.1301,3.0102,3.3203])
x=x.numpy
for i in range(3):
print(round(x[i],2))
运行报错:
TypeError Traceback (most recent call last)
in
2 x=x.numpy
3 for i in range(3):
----> 4 print(round(x[i],2))
TypeError: ‘method’ object is not subscriptable
解决办法:
x=x.numpy后少了括号,补上x=x.numpy()
更多推荐


所有评论(0)