AttributeError: ‘Tensor‘ object has no attribute ‘numpy‘

这是由于tensorflow版本过高所致,为了兼容之前版本的运算,加入语句:tf.enable_eager_execution()

import tensorflow as tf
tf.enable_eager_execution() # 关键

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