1、找出最大值
import tensorflow as tf
max_value = tf.reduce_max([1, 3, 2])
with tf.Session() as sess:
max_value = sess.run(max_value)
print(max_value)
输出结果:
3
2、找出列上的最大值
import tensorflow as tf
max_value = tf.reduce_max([[1, 3, 2],[4,5,6]],reduction_indices=[0])
with tf.Session() as sess:
max_value = sess.run(max_value)
print(max_value)
输出结果:
[4 5 6]
3、找出行上的最大值
import tensorflow as tf
max_value = tf.reduce_max([[1, 3, 2],[4,5,6]],reduction_indices=[1])
with tf.Session() as sess:
max_value = sess.run(max_value)
print(max_value)
输出结果:
[3 6]