Keyword Arguments:
      * dx (float) -- constant spacing between values. If
        neither "x" or "dx" are specified then this defaults to 1.
        Effectively multiplies the result by its value.
  * **dim** (*int*) -- The dimension along which to compute the
    trapezoidal rule. The last (inner-most) dimension by default.

Examples:
  >>> # Cumulatively computes the trapezoidal rule in 1D, spacing is implicitly 1.
  >>> y = torch.tensor([1, 5, 10])
  >>> torch.cumulative_trapezoid(y)
  tensor([3., 10.5])

  >>> # Computes the same trapezoidal rule directly up to each element to verify
  >>> (1 + 5) / 2
  3.0
  >>> (1 + 10 + 10) / 2
  10.5

  >>> # Cumulatively computes the trapezoidal rule in 1D with constant spacing of 2
  >>> # NOTE: the result is the same as before, but multiplied by 2
  >>> torch.cumulative_trapezoid(y, dx=2)
  tensor([6., 21.])
