 DeepLearning,Tensor,argmax - Maple Programming Help

Home : Support : Online Help : Programming : DeepLearning Package : Tensors : Operations on Tensors : DeepLearning/Tensor/argmax

DeepLearning,Tensor,argmax

find index with maximal value over entries of a Tensor

DeepLearning,Tensor,argmin

find index with minimal value over entries of a Tensor

 Calling Sequence argmax(t,opts) argmin(t,opts)

Parameters

 t - Tensor opts - options, as specified below

Options

 • axis=list(integer) or integer

The value of option axis is an integer or list of integers which describes which axis of the input Tensor to reduce across.

 • datatype=integer or integer

The value of option datatype specifies the type of data this Tensor will hold. The default is integer.

 • name=string

The value of option name specifies an optional name for this Tensor, to be displayed in output and when visualizing the dataflow graph.

Description

 • The argmax(t) command returns the index with the largest value across the axes of a Tensor.
 • The argmin(t) command behaves similarly but returns the index with the smallest value across the axes of a Tensor.
 • The index returns by argmax and argmin is zero-based.

Examples

 > $\mathrm{with}\left(\mathrm{DeepLearning}\right):$
 > $t≔\mathrm{Constant}\left(\left[0,7,2,9,3,6,8\right]\right):$
 > $\mathrm{sess}≔\mathrm{Session}\left(\right)$
 ${\mathrm{sess}}{≔}\left[\begin{array}{c}{\mathrm{DeepLearning Session}}\\ {\mathrm{}}\end{array}\right]$ (1)
 > $\mathrm{sess}:-\mathrm{Run}\left(\mathrm{argmax}\left(t,\mathrm{axis}=0\right)\right)$
 ${3}$ (2)
 > $\mathrm{sess}:-\mathrm{Run}\left(\mathrm{argmin}\left(t,\mathrm{axis}=0\right)\right)$
 ${0}$ (3)

Compatibility

 • The DeepLearning,Tensor,argmax and DeepLearning,Tensor,argmin commands were introduced in Maple 2018.