pymc.pytensorf.make_shared_replacements#
- pymc.pytensorf.make_shared_replacements(point, vars, model)[source]#
Make shared replacements for all other variables than the ones passed.
This way functions can be called many times without setting unchanging variables. Allows us to use func.trust_input by removing the need for DictToArrayBijection and kwargs.
- Parameters:
- point: dictionary mapping variable names to sample values
- vars: list of variables not to make shared
- model: model
- Returns:
Dictofvariable->newsharedvariable
Notes
A fresh shared variable per call means the compiled graph differs for every step method instance, so these functions can never be served from a frozen model’s compilation cache. Making the shared variables depend only on the model, and swapping in per-instance ones with
Function.copyafterwards (asValueGradFunction.copy()does), would let these steps reuse a cached graph as well.