Tensor.remove

Tensor.remove(var)
Parameters:

v (pyagrum.DiscreteVariable) – The variable to be removed

Returns:

a reference to the modified tensor

Return type:

pyagrum.Tensor

Warning

IndexError raised if the var is not in the tensor

Parameters:

var (DiscreteVariable)

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.remove(b)  # (the values are lost)
p.names
# ('a',)

Class

Tensor