pymc.SymbolicRandomVariable.clone_with_inner_graph#

SymbolicRandomVariable.clone_with_inner_graph(inner_fgraph)#

Return a copy of this op whose inner graph is inner_fgraph.

Used by the ofg_inner_graph rewrite to bake an already-optimized inner graph into a NEW op without mutating self.

inner_fgraph is the rewrite’s optimized graph and already carries the ordering we must keep: when it has baked inplace ops its DestroyHandler defines a destroy-aware toposort (every reader of a destroyed buffer runs before the op that destroys it). We therefore assign it directly – freeze re-roots it on nominal inputs by position and bakes that order into the frozen graph (and each node’s topo_idx). Routing it through construct_nominal_fgraph instead would rebuild and re-toposort, losing the destroy-aware order. Mirrors Scan.clone_with_inner_graph.