mindspore.ops.cummax

查看源文件
mindspore.ops.cummax(input, axis)[源代码]

返回tensor在指定轴上的累积最大值及其索引。

yi=max(x1,x2,...,xi)
参数:
  • input (Tensor) - 输入tensor。

  • axis (int) - 指定计算的轴。

返回:

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

支持平台:

Ascend GPU CPU

样例:

>>> import mindspore
>>> input = mindspore.tensor([[3, 4, 6, 10], 
...                           [1, 6, 7, 9], 
...                           [4, 3, 8, 7], 
...                           [1, 3, 7, 9]])
>>> mindspore.ops.cummax(input, axis=0)
(Tensor(shape=[4, 4], dtype=Int64, value=
 [[ 3,  4,  6, 10],
  [ 3,  6,  7, 10],
  [ 4,  6,  8, 10],
  [ 4,  6,  8, 10]]),
 Tensor(shape=[4, 4], dtype=Int64, value=
 [[0, 0, 0, 0],
  [0, 1, 1, 0],
  [2, 1, 2, 0],
  [2, 1, 2, 0]]))