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

Allow using closure that may return an error (partial) #112

Closed
wants to merge 5 commits into from

Conversation

minghuaw
Copy link
Collaborator

@minghuaw minghuaw commented Sep 20, 2024

Closes #113

This PR allow variants of vjp, jvp, value_and_grad, and grad to take a closure that returns a Result. Support for compile to take such closure is NOT included because

  1. Returning an error in the closure ml-explore/mlx-c#34
  2. the compiler cache would cache the result if an empty mlx_vector_array were returned to get around Returning an error in the closure ml-explore/mlx-c#34

@minghuaw minghuaw marked this pull request as draft September 20, 2024 21:07
@minghuaw minghuaw changed the title Allow using closure that may return an error Allow using closure that may return an error (partial) Sep 21, 2024
@minghuaw minghuaw marked this pull request as ready for review September 21, 2024 00:46
@minghuaw
Copy link
Collaborator Author

Closed in favour of #116

@minghuaw minghuaw closed this Sep 30, 2024
@minghuaw minghuaw deleted the api/closure-with-error branch September 30, 2024 15:47
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.

vjp, jvp, grad, and value_and_grad don't take closure that returns Result<_, Exception>
1 participant