mindspore.mint.max

View Source On AtomGit
mindspore.mint.max(input) Tensor[source]

Return the maximum value of the input tensor.

Parameters

input (Tensor) – The input tensor.

Returns

Tensor

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> x = mindspore.tensor([0.0, 0.4, 0.6, 0.7, 0.1], mindspore.float32)
>>> mindspore.mint.max(x)
Tensor(shape=[], dtype=Float32, value= 0.7)
mindspore.mint.max(input, dim, keepdim=False)[source]

Return the maximum value of the input tensor along the specified dimension.

Parameters
  • input (Tensor) – The input tensor.

  • dim (int) – Specify the dimension to compute.

  • keepdim (bool, optional) – Whether the output tensor has dim retained. Default False.

Returns

Tuple of two tensors, tuple(max, max_indices).

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> x = mindspore.tensor([0.0, 0.4, 0.6, 0.7, 0.1], mindspore.float32)
>>> mindspore.mint.max(x, 0, keepdim=True)
(Tensor(shape=[1], dtype=Float32, value= [ 6.99999988e-01]), Tensor(shape=[1], dtype=Int64, value= [3]))
mindspore.mint.max(input, other) Tensor[source]

For details, please refer to mindspore.mint.maximum().