pymoose.sum#

pymoose.sum(x, axis=None, placement=None)[source]#

Sum-reduce an input tensor.

Computes the sum of tensor elements along a particular axis, or for the entire tensor if axis=None.

Parameters
  • x – A tensor.

  • axis – An optional dimension along which to sum-reduce the tensor. If None, sum-reduces the entire tensor and outputs a scalar tensor.

  • placement – An optional Placement to pin this operation to.

Returns

The summed input, with one or all dimensions reduced out.