在使用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
暫時這些,後面遇到會繼續補充。當然,也歡迎補充-。-