AttributeError: 'Tensor' object has no attribute 'numpy'
Full error message
I downloaded this code from GitHub. predicted_id = tf.multinomial(tf.exp(predictions), num_samples=1)[0][0].numpy() But I get an error that says: AttributeError: 'Tensor' object has no attribute 'numpy' What is wrong, and how do I fix it?
Solutionsource: stackoverflow \u2197
I suspect the place where you copied the code from had eager execution enabled, i.e. had invoked tf.enable_eager_execution() at the start of the program. You could do the same. UPDATE: Note that eager execution is enabled by default in TensorFlow 2.0. So the answer above applies only to TensorFlow 1.x
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/ba151c4500fe3a48d8d3e620af242b9de4fce45c05082e5aedb42a42d29c24e5hash \u00b7 ba151c4500fe3a48d8d3e620af242b9de4fce45c05082e5aedb42a42d29c24e5