tensor.argmax
fn argmax(self: @Tensor<T>, axis: i32, keepdims: Option<bool>, select_last_index: Option<bool>) -> Tensor<i32>;Returns the index of the maximum value along the specified axis.
Args
self(@Tensor<T>) - The input tensor.axis(i32) - The axis along which to compute the argmax.keepdims(Option<bool>) - If true, retains reduced dimensions with length 1. Defaults to true.select_last_index(Option<bool>) - If true, the index of the last occurrence of the maximum value is returned. Defaults to false.
Panics
Panics if axis is not in the range of the input tensor's dimensions.
Returns
A new Tensor<T> instance containing the indices of the maximum values along the specified axis.
Examples
Case 1: argmax with default parameters
Case 2: argmax with keepdims set to false
Case 3: argmax with select_last_index set to true
Last updated
Was this helpful?