Tensor.sumOut

Tensor.sumOut(*args)

Projection using sum as operation.

Parameters:

varnames (str | Iterable[str]) – the set of vars to eliminate

Returns:

the projected Tensor

Return type:

pyagrum.Tensor

Raises:

pyagrum.InvalidArgument – If varnames contains only one variable that does not exist in the Tensor

Example

import pyagrum as gum

a, b = gum.LabelizedVariable("a", "a", 2), gum.LabelizedVariable("b", "b", 3)
p = gum.Tensor().add(a).add(b).fillWith([1, 2, 3, 4, 5, 6])
p.sumOut(["a"]).tolist()
# [3.0, 7.0, 11.0]

Class

Tensor