Python报错:AttributeError: ‘Tensor‘ object has no attribute ‘numpy‘

Python报错:
Traceback (most recent call last):
File “code_09_mydataset.py”, line 138, in
img = Image.fromarray(np.uint8(i.numpy()))
AttributeError: ‘Tensor’ object has no attribute ‘numpy’

参考文献:

https://blog.csdn.net/LearnToPain/article/details/102996795

解决方案:
代码最前加

tf.enable_eager_execution()

方法源于:
https://www.tensorflowers.cn/t/6896

你可能感兴趣的:(Python,深度学习,python,tensorflow,linux)