pymc.pytensorf.constant_fold(xs, raise_not_constant=True)[source]#

Use constant folding to get constant values of a graph.

xs: Sequence of TensorVariable

The variables that are to be constant folded

raise_not_constant: bool, default True

Raises NotConstantValueError if any of the variables cannot be constant folded. This should only be disabled with care, as the graphs are cloned before attempting constant folding, and any old non-shared inputs will not work with the returned outputs