Tensor.shape

property Tensor.shape
Returns:

the domain sizes of the variables of the tensor, in the order of variable(i)

Return type:

tuple[int]

Warning

p.shape and p[:].shape list the dimensions in different order

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.shape
# (2, 3)
p.toarray().shape  # numpy order
# (3, 2)

Class

Tensor