Tensor.domainSize

Tensor.domainSize()

Compute the size of the domain of the Tensor, i.e., the product of the domain sizes of the variables in the Tensor.

Returns:

the size of the domain of the Tensor (the number of values it can take)

Return type:

int

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.domainSize()
# 6

Class

Tensor