torch.sum
torch.sum(input, *, dtype=None) -> Tensor
Returns the sum of all elements in the "input" tensor.
Parameters:
      input (Tensor) -- the input tensor.
Keyword Arguments:
      dtype ("torch.dtype", optional) -- the desired data type of
      returned tensor. If specified, the input tensor is casted to
      "dtype" before the operation is performed. This is useful for
      preventing data type overflows. Default: None.
Example:
  >>> a = torch.randn(1, 3)
  >>> a
  tensor([[ 0.1133, -0.9567,  0.2958]])
  >>> torch.sum(a)
  tensor(-0.5475)

torch.sum(input, dim, keepdim=False, *, dtype=None) -> Tensor
Returns the sum of each row of the "input" tensor in the given
   dimension "dim". If "dim" is a list of dimensions, reduce over all
   of them.
If "keepdim" is "True", the output tensor is of the same size as
   "input" except in the dimension(s) "dim" where it is of size 1.