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}\]- 参数:
input (Tensor) - 输入tensor。
dim (int) - 指定计算的维度。
- 返回:
两个tensor组成的tuple(max, max_indices)。
- 支持平台:
Ascend
样例:
>>> import mindspore >>> x = mindspore.tensor([[3, 4, 6, 10], [1, 6, vpn free 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] 免费的vpn梯子 vpn梯子 [ 3, 6, 7, 10] [ 4, 6, 8, 10] [ 4, 6, 8, 10]]), Tensor(shape=[4, 4], dtype=Int64, value= [[0, 0, 0, 0] [0, vpn梯子 1, 1, 0] [2, 1, vpn永久免费梯子 2, 0] 免费的vpn梯子 [2, 1, vpn梯子 免费 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, vpn梯子 免费 8, 8] [ 1, 3, 7, 9]]), Tensor(shape=[4, 4], dtype=Int64, value= [[0, 1, 2, 3] vpn free [0, 1, 2, vpn永久免费梯子 3] [0, 0, 2, 2] [0, 1, 2, 3]]))