Skip to content

Commit

Permalink
short reproducible example
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrine committed Jul 24, 2023
1 parent 484c7d6 commit 002979b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/graph/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,16 +800,12 @@ def test_single_pass_per_node(self, mocker):
import pytensor.graph.basic

inspect = mocker.spy(pytensor.graph.basic, "variable_depends_on")
variables = [at.scalar(f"v{i}") for i in range(3)]
for i in range(20):
variables.append(
at.add(
variables[i],
variables[(i**3) % len(variables)],
variables[(i**2) % len(variables)],
)
)
truncated_graph_inputs(variables[-5:], variables[15:-5:5])
x = at.dmatrix("x")
m = x.shape[0][None, None]

f = x / m
w = x / m - f
truncated_graph_inputs([w], [x])
# make sure there were exactly the same calls as unique variables seen by the function
assert len(inspect.call_args_list) == len(
{a for ((a, b), kw) in inspect.call_args_list}
Expand Down

0 comments on commit 002979b

Please sign in to comment.