torch.cummax
- torch.cummax(input, dim, *, out=None)
Returns a namedtuple
(values, indices)wherevaluesis the cumulative maximum of elements ofin the dimension . And is the index location of each maximum value found in the dimension .
Returns a namedtuple (values, indices) where values is the cumulative maximum of
elements of in the dimension . And is the index
location of each maximum value found in the dimension .
dimindicesdimExample:
>>> a = torch.randn(10)
>>> a
tensor([-0.3449, -1.5447, 0.0685, -1.5104, -1.1706, 0.2259, 1.4696, -1.3284,
1.9946, -0.8209])
>>> torch.cummax(a, dim=0)
torch.return_types.cummax(
values=tensor([-0.3449, -0.3449, 0.0685, 0.0685, 0.0685, 0.2259, 1.4696, 1.4696,
1.9946, 1.9946]),
indices=tensor([0, 0, 2, 2, 2, 5, 6, 6, 8, 8]))