2017-02-17 50 views

回答

5

以下是argmax的源代碼(來自https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/ops/math_ops.py)。

# pylint: disable=redefined-builtin 
# TODO(aselle): deprecate arg_max 
def argmax(input, axis=None, name=None, dimension=None): 
    if dimension is not None: 
    if axis is not None: 
     raise ValueError("Cannot specify both 'axis' and 'dimension'") 
    axis = dimension 
    elif axis is None: 
    axis = 0 
    return gen_math_ops.arg_max(input, axis, name) 

正如你所看到的,argmax是內部使用arg_max。同樣從代碼中,我推薦使用argmax,因爲arg_max可能會很快被棄用。