dpctl.tensor.argmax(x, /, *, axis=None, keepdims=False, out=None)[source]

Returns the indices of the maximum values of the input array x along a specified axis.

When the maximum value occurs multiple times, the indices corresponding to the first occurrence are returned.

  • x (usm_ndarray) – input array.

  • axis (Optional[int]) – axis along which to search. If None, returns the index of the maximum value of the flattened array. Default: None.

  • keepdims (Optional[bool]) – if True, the reduced axes (dimensions) are included in the result as singleton dimensions, so that the returned array remains compatible with the input arrays according to Array Broadcasting rules. Otherwise, if False, the reduced axes are not included in the returned array. Default: False.

  • out (Optional[usm_ndarray]) – the array into which the result is written. The data type of out must match the expected shape and the expected data type of the result. If None then a new array is returned. Default: None.


an array containing the indices of the first occurrence of the maximum values. If the entire array was searched, a zero-dimensional array is returned. The returned array has the default array index data type for the device of x.

Return type: