mindspore.ops.cummax

View Source On Gitee
mindspore.ops.cummax(input, axis)[source]

Return the cumulative maximum values and their indices along the given axis of the tensor.

yi=max(x1,x2,...,xi)
Parameters
  • input (Tensor) – The input tensor.

  • axis (int) – Specify the axis for computation.

Returns

Tuple(max, max_indices) of 2 tensors.

Supported Platforms:

Ascend GPU CPU

Examples

>>> 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]]))