Skip to content

Commit 26f9aaa

Browse files
committed
Tidy
1 parent 98bd344 commit 26f9aaa

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pymc/model/transform/basic.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
# limitations under the License.
1414
from collections.abc import Sequence
1515

16-
from pytensor import Variable
17-
from pytensor.graph import ancestors, node_rewriter
18-
from pytensor.graph.rewriting.basic import out2in
16+
from pytensor import Variable, clone_replace
17+
from pytensor.graph import ancestors
18+
from pytensor.graph.fg import FunctionGraph
1919

2020
from pymc.data import MinibatchOp
2121
from pymc.model.core import Model
@@ -62,7 +62,7 @@ def parse_vars(model: Model, vars: ModelVariable | Sequence[ModelVariable]) -> l
6262
return [model[var] if isinstance(var, str) else var for var in vars_seq]
6363

6464

65-
def remove_minibatched_nodes(model: pm.Model) -> pm.Model:
65+
def remove_minibatched_nodes(model: Model) -> Model:
6666
"""Remove all uses of pm.Minibatch in the Model."""
6767
fgraph, _ = fgraph_from_model(model)
6868

@@ -75,11 +75,10 @@ def remove_minibatched_nodes(model: pm.Model) -> pm.Model:
7575
old_outs, old_coords, old_dim_lengths = fgraph.outputs, fgraph._coords, fgraph._dim_lengths
7676
# Using `rebuild_strict=False` means all coords, names, and dim information is lost
7777
# So we need to restore it from the old fgraph
78-
new_outs = pytensor.clone_replace(old_outs, replacements, rebuild_strict=False)
78+
new_outs = clone_replace(old_outs, replacements, rebuild_strict=False)
7979
for old_out, new_out in zip(old_outs, new_outs):
8080
new_out.name = old_out.name
81-
fgraph = pytensor.graph.fg.FunctionGraph(outputs=new_outs, clone=False)
81+
fgraph = FunctionGraph(outputs=new_outs, clone=False)
8282
fgraph._coords = old_coords
8383
fgraph._dim_lengths = old_dim_lengths
8484
return model_from_fgraph(fgraph, mutate_fgraph=True)
85-

0 commit comments

Comments
 (0)