经常使用的函数:ide
tf.argmax(input, axis=None, name=None, dimension=None)
1 import tensorflow as tf 2 import numpy as np 3 4 A , B = [[1, 3, 4, 5, 6]],[[1, 3, 4], [2, 4, 1]] 5 with tf.Session() as sess: 6 print(sess.run(tf.argmax(A, 1))) 7 print(sess.run(tf.argmax(B, 1)))
结果:函数
[4]
[2 1]spa
tf.case(pred_fn_pairs, default=None, exclusive=False, strict=False, name='case')
tf.cast(data,tf.float32)
代码:code
1 import tensorflow as tf 2 import numpy as np 3 4 A , B = [[1, 3, 4, 5, 6]],[[1, 3, 4, 3, 2]] 5 with tf.Session() as sess: 6 print(sess.run(tf.equal(A, B)))
结果:[[ True True True False False]]blog