Tensor.putFirst
- Tensor.putFirst(varname)
- Parameters:
v (
pyagrum.DiscreteVariable) – The variable for which the index should be 0.varname (
str)
- Returns:
a reference to the modified tensor
- Return type:
- Raises:
pyagrum.InvalidArgument – If the var is not 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.names
# ('a', 'b')
p.putFirst("b").names
# ('b', 'a')
Class