sum

static OperationNamespace.sum(input_tensor, *, name=None)

Returns the sum of all the elements in a tensor (or a list of tensors with the same shape).

Parameters
  • input_tensor (np.ndarray or Tensor or List[Tensor]) – The tensor whose elements you want to sum.

  • name (str, optional) – The name of the node.

Returns

The single-element tensor containing the input tensor’s sum.

Return type

Tensor