Tensor.deterministicTensor

static Tensor.deterministicTensor(*args)

This static method generates a Tensor representing a deterministic function of a pyagrum.DiscreteVariable) such as a hard evidence.

Parameters:
  • var (pyagrum.DiscreteVariable) – the variable to use

  • value (int | str) – the indice or the label of the value for the variable

Returns:

The representation of the deterministic function as a pyagrum.Tensor.

Return type:

pyagrum.Tensor

Example

import pyagrum as gum

a = gum.LabelizedVariable("a", "a", ["x", "y", "z"])
gum.Tensor.deterministicTensor(a, "y").tolist()
# [0.0, 1.0, 0.0]
gum.Tensor.deterministicTensor(a, 2).tolist()
# [0.0, 0.0, 1.0]

Class

Tensor