常用的函数:
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]
tf.case(pred_fn_pairs, default=None, exclusive=False, strict=False, name=‘case‘) 类型转换
代码:
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]]
原文:https://www.cnblogs.com/WSX1994/p/10950026.html