Tensor.reorganize
- Tensor.reorganize(*args)
Create a new Tensor with another order.
- Parameters:
varnames (
list[str]) – a list of the var names in the new order- Returns:
a reference to the modified tensor
- Return type:
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])
q = p.reorganize(["b", "a"])
q.names
# ('b', 'a')
q[{"a": 1, "b": 2}] == p[{"a": 1, "b": 2}]
# True
Class