CIM.asTensor

CIM.asTensor()
Returns:

a copy of the internal tensor

Return type:

pyagrum.Tensor

Example

import numpy as np

import pyagrum as gum
import pyagrum.ctbn as ct

cim = ct.CIM()
cim.add(gum.LabelizedVariable(ct.CIM.varI("A"), "", ["a0", "a1"]))  # the state before a transition
cim.add(gum.LabelizedVariable(ct.CIM.varJ("A"), "", ["a0", "a1"]))  # the state after
cim.fromMatrix(np.array([[-2.0, 2.0], [1.0, -1.0]]))
print(cim.asTensor())
#
#       ║  A#i              │
# A#j   ║a0       │a1       │
# ──────║─────────│─────────│
# a0    ║ -2.0000 │ 1.0000  │
# a1    ║ 2.0000  │ -1.0000 │

Class

CIM