pangolin.interface.sum

Contents

pangolin.interface.sum#

pangolin.interface.sum(x, axis)#

Sum an array along one axis, removing that axis from the result.

Negative axes count from the end. The input must be nonscalar, and axis must refer to an existing axis.

Parameters:
  • x (RVLike) – Array to sum. Non-RV values are converted to constant RVs.

  • axis (int) – Axis to remove.

Return type:

RV

Examples

>>> import pangolin.interface as pi
>>> pi.sum([[1, 2, 3], [4, 5, 6]], axis=0).shape
(3,)
>>> pi.sum([[1, 2, 3], [4, 5, 6]], axis=-1).shape
(2,)