1. 程式人生 > >TF-tf.arg_max 介紹

TF-tf.arg_max 介紹

del bsp lis active ax1 最大值 例如 必須 form

定義為

    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]

TF-tf.arg_max 介紹