Skip to content

Make chunk threshold configurable #1213

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

Conversation

lassepe
Copy link
Contributor

@lassepe lassepe commented Apr 26, 2022

This exposes the chunk threshold as an option of Zygote.forwarddiff.

@dfridovi
Copy link

Let's do this!

return y, ȳ -> (nothing, reshape_scalar(x, J*vec_scalar(ȳ)))
@adjoint function forwarddiff(f, x; chunk_threshold = ForwardDiff.DEFAULT_CHUNK_THRESHOLD)
y, J = forward_jacobian(f, x; chunk_threshold = chunk_threshold)
return y, ȳ -> (nothing, reshape_scalar(x, J * vec_scalar(ȳ)))
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep the previous indentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, sorry for that! Fixed it.

@lassepe lassepe requested a review from CarloLucibello May 1, 2022 10:29
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.

3 participants