gEconpy.model.compile.sympy_to_pytensor#
- gEconpy.model.compile.sympy_to_pytensor(inputs, outputs, cache=None, cse=False)#
Convert sympy expressions to pytensor graph nodes.
This is the sympytensor bridge: it takes sympy symbols and expressions and returns the corresponding pytensor input and output nodes, along with the updated cache that maintains the mapping between sympy and pytensor symbols.
- Parameters:
- inputs
listofsympySymbol Sympy input symbols.
- outputs
listofsympyexpression, orsympyMutableDenseMatrix Sympy output expressions.
- cache
dict, optional Dictionary mapping sympytensor cache keys to pytensor variables. Used to maintain a consistent namespace across multiple conversions. Default is an empty dictionary.
- csebool, optional
Eliminate common subexpressions (
sp.cse) before conversion. Shrinks the forward graph but inflates gradient compilation, because the shared subexpressions become high-fanout nodes that densify the reverse-mode backward graph; enable only for forward-only compiles. Default False.
- inputs
- Returns: