Reputation: 43
I want to test the function of tf.argmax(),but when I run the code , I encountered an error. Here is my code
import tensorflow as tf
a=tf.argmax([1,0,0],1)
with tf.Session() as sess:
print(sess.run(a))
My environment is python3 + tf1.3.
What's wrong with the code?
Upvotes: 0
Views: 1877
Reputation: 11
In tensorflow argmax() and argmin() functions are used to find the largest and the smallest value index in a vector. The problem with your code is that you specified the axis argument as "1" which means that you want to search in two dimension array.Check this link:https://www.dotnetperls.com/arg-max-tensorflow
import tensorflow as tf
a=tf.argmax([1,0,0],0)
with tf.Session() as sess:
print(sess.run(a))
Upvotes: 1