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

Remove has_annotated_args/has_annotated_return check for when aut… #205

Merged
merged 3 commits into from
May 19, 2024

Conversation

nimashoghi
Copy link
Contributor

…omatically adding @jaxtyped decorator.

@nimashoghi nimashoghi marked this pull request as draft May 17, 2024 17:07
@patrick-kidger
Copy link
Owner

This looks reasonable to me! I'd be happy to merge this as a non-draft PR.

@nimashoghi
Copy link
Contributor Author

nimashoghi commented May 18, 2024

@patrick-kidger Thanks! I was just holding off on this so I can add a simple test, which I just pushed.

I was hoping to add one more test which tests for inline (function body) annotations, but it seems like jaxtyping doesn't catch these kinds of errors (? not sure on this). I wasn't able to get a test like below working:

#
# Test that body annotations (but no arg/return annotations) are checked


def body_annot_test(x):
    y: Float32[jnp.ndarray, " b"] = x
    _ = y


body_annot_test(jnp.array([1.0]))
with pytest.raises(ParamError):
    body_annot_test(jnp.array(1))

Aside from this, though, this should be good to go.

@nimashoghi nimashoghi marked this pull request as ready for review May 18, 2024 18:04
@patrick-kidger patrick-kidger merged commit 1ae675f into patrick-kidger:main May 19, 2024
1 check passed
@patrick-kidger
Copy link
Owner

This looks great to me! Thank you for the fix, and merged :)

As for inline annotations, see #153 (comment) and #92 (comment)!

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

Successfully merging this pull request may close these issues.

2 participants