在使用tensorflow过程中,会有以下几个问题,在未在代码中添加tf.enable_eager_execution()之前会出现以下问题,在添加之后即可解决
- 在运行grads = tape.gradient(loss, variables)这句代码时会报错:AttributeError: 'RefVariable' object has no attribute '_id'
- 在运行MLP模型时,print("batch %d: loss %f" % (batch_index, loss.numpy()))这一行代码出现错误:'Tensor' object has no attribute 'numpy
暂时这些,后面遇到会继续补充。当然,也欢迎补充-。-