定义为

    def arg_max(input, dimension, name=None)

作用是取行或者列的最大值的位置。

input:
类型为 float32, float64, int64, int32, uint8, uint16, int16, int8, complex64, complex128, qint8, quint8, qint32, half的tensor

 

dimension:

必须为int32, int64. int32,取值为0或1.

 

name:
名字

returns:
返回一个tensor

例如以下测试

import tensorflow as tf

list_a = [[1,2,3,4,5],
          [3,3,3,1,6],
          [5,1,2,1,1]]

sess = tf.InteractiveSession()

argmax0 = tf.arg_max(list_a, 0)
print("argmax 0={}".format(argmax0.eval()))
argmax1 = tf.arg_max(list_a, 1)
print("argmax 1={}".format(argmax1.eval()))

结果为

argmax 0=[2 1 0 0 1]
argmax 1=[4 4 0]

 

相关文章:

  • 2021-09-08
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
  • 2021-08-02
  • 2021-11-10
  • 2021-11-24
  • 2022-02-06
猜你喜欢
  • 2021-12-14
  • 2022-12-23
  • 2021-06-14
  • 2022-01-12
  • 2021-09-03
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案