mindspore.mint.cummax
- mindspore.mint.cummax(input, dim)[源代码]
返回tensor在指定维度上的累积最大值及其索引。
\[\begin{split}\begin{array}{ll} \\ y_{i} = \max(x_{1}, x_{2}, ... , x_{i}) \end{array}\end{split}\]说明
Ascend不支持GE后端。
- 参数:
input (Tensor) - 输入tensor。
dim (int) - 指定计算的维度。
- 返回:
两个tensor组成的tuple(max, max_indices)。
- 支持平台:
Ascend
样例:
>>> import mindspore >>> x = mindspore.tensor([[3, 4, 6, 10], [1, 6, 7, 9], [4, 3, 8, 7], [1, 3, 7, 9]]) >>> mindspore.mint.cummax(x, dim=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]])) >>> mindspore.mint.cummax(x, dim=1) (Tensor(shape=[4, 4], dtype=Int64, value= [[ 3, 4, 6, 10] [ 1, 6, 7, 9] [ 4, 4, 8, 8] [ 1, 3, 7, 9]]), Tensor(shape=[4, 4], dtype=Int64, value= [[0, 1, 2, 3] [0, 1, 2, 3] [0, 0, 2, 2] [0, 1, 2, 3]]))