Skip to content

Cleanup OpFromGraph tests #699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/compile/test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,15 @@ def test_outputs_consistency(self):

def test_explicit_input_from_constant(self):
x = pt.dscalar("x")
y = constant(1.0, name="y")
y = constant(1.0, dtype=x.type.dtype, name="y")
test_ofg = OpFromGraph([x, y], [x + y])

out = test_ofg(x, y)
assert out.eval({x: 5}) == 6

out = test_ofg(x, x)
assert out.eval({x: 5}) == 10

def test_explicit_input_from_shared(self):
x = pt.dscalar("x")
y = shared(1.0, name="y")
Expand All @@ -576,7 +579,10 @@ def test_explicit_input_from_shared(self):
out = test_ofg(x, y)
assert out.eval({x: 5}) == 6
y.set_value(2.0)
assert out.eval({x: 6})
assert out.eval({x: 6}) == 8

out = test_ofg(y, y)
assert out.eval() == 4


@config.change_flags(floatX="float64")
Expand Down
Loading