Table of Contents
Shortcuts

# torch.cummax

torch.cummax(input, dim, *, out=None)

  Returns a namedtuple `(values, indices)` where `values` is the cumulative maximum of elements of `input` in the dimension `dim`. And `indices` is the index location of each maximum value found in the dimension `dim`.

  y i=m a x(x 1,x 2,x 3,…,x i)y_i = max(x_1, x_2, x_3, \dots, x_i) y i​=ma x(x 1​,x 2​,x 3​,…,x i​)
  Parameters:

    - input (Tensor) – the input tensor.

    - dim (int) – the dimension to do the operation over

  Keyword Arguments:

    out (tuple, optional) – the result tuple of two output tensors (values, indices)

  Example:

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

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.