mindspore.mint.max

查看源文件
mindspore.mint.max(input) Tensor[源代码]

返回tensor的最大值。

参数:
  • input (Tensor) - 输入tensor。

返回:

Tensor

支持平台:

Ascend

样例:

>>> 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)[源代码]

返回tensor在指定维度上的最大值及其索引。

参数:
  • input (Tensor) - 输入tensor。

  • dim (int) - 指定计算维度。

  • keepdim (bool, 可选) - 输出tensor是否保留维度。默认 False

返回:

两个tensor组成的tuple(max, max_indices)。

支持平台:

Ascend

样例:

>>> 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[源代码]

详情请参考 mindspore.mint.maximum()

支持平台:

Ascend