


x = torch.tensor([1, 3, 6])
      >>> torch.trapezoid(y, x)
      28.5



  >>> # Computes the same trapezoidal rule directly to verify
  >>> ((3 - 1) * (1 + 5) + (6 - 3) * (5 + 10)) / 2
  28.5

  >>> # Computes the trapezoidal rule for each row of a 3x3 matrix
  >>> y = torch.arange(9).reshape(3, 3)
  tensor([[0, 1, 2],
          [3, 4, 5],
          [6, 7, 8]])
  >>> torch.trapezoid(y)
  tensor([ 2., 8., 14.])

  >>> # Computes the trapezoidal rule for each column of the matrix
  >>> torch.trapezoid(y, dim=0)
  tensor([ 6., 8., 10.])

  >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix
  >>> #   with the same arbitrary spacing
  >>> y = torch.ones(3, 3)
  >>> x = torch.tensor([1, 3, 6])
  >>> torch.trapezoid(y, x)
  array([5., 5., 5.])

  >>> # Computes the trapezoidal rule for each row of a 3x3 ones matrix
  >>> #   with different arbitrary spacing per row
  >>> y = torch.ones(3, 3)
