Tags: pymc-devs/pytensor
Tags
Fix rewrites that were relaxed from Advanced(Inc)Subtensor1 Op but re… …lied on their restrictions AdvancedSubtensor1 / AdvancedIncSubtensor1 guaranteed a single 1-D integer index on the leading axis. Three rewrites retargeted onto the general Ops still relied on that; the last two returned wrong results silently. - local_useless_AdvancedSubtensor1 gated on idx_list == (0,), which a boolean mask also satisfies, and crashed comparing it against arange. Deleted: local_adv_idx_to_slice already covers the arange take. - local_set_to_inc_subtensor ignored idx_list and compared only the first index, so a read of x[:, i] matched a write to x[i] and the collapsed inc hit the wrong axis. It now compares and rebuilds with all of them, gated on _advanced_indices_jointly_unique. - local_subtensor_make_vector mapped a constant index through int(), reading a boolean mask as the positions 0/1. Left for bool_idx_to_nonzero instead.
Don't bail numba core-shape rewrite on RVs that already feed the node introduce_explicit_core_shape_rv refused to wrap a RandomVariable when its core shape read the shape of another RandomVariable already feeding it (e.g. an MvNormal whose random `mean`'s trailing dimension is the core shape). That RV is computed before the node, so reading its shape needs no extra draw -- but `applys_between(node.inputs, [core_shape])` still yields such an input RV as the owner of a boundary variable, so the node was left unwrapped and later crashed numba funcify with "necessary to replace RandomVariable with RandomVariableWithCoreShape". Block the ancestor walk at the node's own inputs and only bail on a RandomVariable reachable past them (a genuine extra draw for the shape).
Deprecate the clone_inner_graph(s) machinery Cloning an outer graph used to optionally deep-clone the inner graphs of HasInnerGraph ops (clone_inner_graph(s)=True). Now that every inner-graph op (Scan/OpFromGraph/Composite/ScipyWrapperOp) is immutable -- clone() returns self -- that deep-clone is always a no-op, so drop the branch throughout the clone machinery (Apply.clone, Apply.clone_with_new_inputs, clone, clone_get_equiv, FunctionGraph.clone, rebuild_collect_shared). The public clone_inner_graph(s) kwarg is kept as a deprecated, ignored no-op that emits a FutureWarning; only the internal clone_node_and_cache (and its op-clone caching) loses it outright.
Don't register indexed-elemwise fusion by default The indexed-elemwise fusion (IndexedElemwise), introduced in 3.0.4, can trigger a RecursionError during OpFromGraph shape inference on some numba graphs (e.g. FullRankADVI). It was too risky to ship in a minor release; disable its default registration on the 3.0.x line until the proper fix (non-recursive core-shape construction) is backported from main.
Avoid deep recursion in OpFromGraph.infer_shape clone_replace rebuilds the shape graph through the recursive clone_v_get_shared_updates, which exceeds Python's recursion limit on deep inner graphs (e.g. the fused IndexedElemwise Composites produced by numba-mode FullRankADVI), raising RecursionError during infer_shape. Use the iterative graph_replace instead.
PreviousNext