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

Fixed and added tests for JacobianLinearOperator(jac="bwd") #87

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

patrick-kidger
Copy link
Owner

No description provided.

if self.jac == "fwd":
_, out = jax.jvp(fn, (self.x,), (vector,))
else:
assert self.jac == "bwd"
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to do something like

       if self.jac == "fwd":
            ...
       elif self.jac == "bwd":
            ...
       else:
            raise ValueError('jac should be "fwd" or "bwd"')

?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Agreed! Just done.

@patrick-kidger patrick-kidger merged commit c664851 into main Mar 23, 2024
3 of 4 checks passed
@patrick-kidger patrick-kidger deleted the better-forward-jacobian branch March 23, 2024 13:58
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