我是靠谱客的博主 留胡子日记本,这篇文章主要介绍tensorflow相关函数___tf.reduce_max(),现在分享给大家,希望可以做个参考。

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]
 

注意:行是reduction_indices=[1] ;

 

最后

以上就是留胡子日记本最近收集整理的关于tensorflow相关函数___tf.reduce_max()的全部内容,更多相关tensorflow相关函数___tf内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(123)

评论列表共有 0 条评论

立即
投稿
返回
顶部