Skip to content
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

Removes Function Graph, set_test_value/ get_test_value #1107

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

AdvH039
Copy link

@AdvH039 AdvH039 commented Nov 28, 2024

Description

Removes the FunctionGraph mechanism of taking inputs and outputs and instead takes them directly in compare_py_and_x . Remove the setting getting of test_values into variables in compare_py_and_x and instead passes them directly to the function.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pytensor--1107.org.readthedocs.build/en/1107/

@@ -68,8 +70,8 @@ def compare_jax_and_py(
if assert_fn is None:
assert_fn = partial(np.testing.assert_allclose, rtol=1e-4)

fn_inputs = [i for i in fgraph.inputs if not isinstance(i, SharedVariable)]
pytensor_jax_fn = function(fn_inputs, fgraph.outputs, mode=jax_mode)
fn_inputs = [i for i in inputs if not isinstance(i, SharedVariable)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need any filter anymore. just pass inputs directly

@@ -135,332 +133,276 @@ def test_replaced_shared_rng_storage_ordering_equality():


@pytest.mark.parametrize(
"rv_op, dist_params, base_size, cdf_name, params_conv",
"rv_op, dist_params, base_size, cdf_name, params_conv, test_values",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make test_values come after dist_params for readability

)


@pytest.mark.parametrize(
"x, exc",
"x, exc,test_values",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in all cases put test values after x for readability

@@ -31,4 +31,4 @@ repos:
hooks:
- id: ruff
args: ["--fix", "--output-format=full"]
- id: ruff-format
- id: ruff-format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line at end of file accidentally removed?

@ricardoV94
Copy link
Member

ricardoV94 commented Dec 3, 2024

@AdvH039 changes looks great. There are some conflicts that emerged since you opened the PR. If you can fix them we can merge. Optionally, but not a blocker, if you could put the test_values after the tensor inputs in the parametrize that would be a bit more readable. This would be everywhere, not just the 2/3 odd places I commented above

I understand it's a lot of work, so feel free to decline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't create useless FunctionGraph in linker tests
2 participants