Skip to content

Comparison of Callback Functions #13555

Answered by mattjj
ntenenz asked this question in General
Dec 8, 2022 · 4 comments · 19 replies
Discussion options

You must be logged in to vote

Thanks for the question! These are all a bit different:

  • jax.make_array_from_callback is just about array creation, like an analogue of jnp.array but more general to work in distributed multi-controller scenarios. It's different from the other two.
  • jax.pure_callback is a way to call a functionally pure Python function within staged-out (e.g. jitted) code. It's one of the new set of callbacks, along with e.g. jax.debug.debug_callback.
  • jax.experimental.host_callback is essentially deprecated in the sense that we don't recommend using it if you can avoid it, and instead we suggest using jax.debug.debug_callback or jax.pure_callback where possible.

Replies: 4 comments 19 replies

Comment options

You must be logged in to vote
7 replies
@ntenenz
Comment options

@jakevdp
Comment options

@mattjj
Comment options

@jakevdp
Comment options

@mattjj
Comment options

Answer selected by ntenenz
Comment options

You must be logged in to vote
6 replies
@zhaopku
Comment options

@jakevdp
Comment options

@zhaopku
Comment options

@jakevdp
Comment options

@sharadmv
Comment options

sharadmv Apr 7, 2023
Collaborator

Comment options

You must be logged in to vote
1 reply
@jakevdp
Comment options

Comment options

You must be logged in to vote
5 replies
@jakevdp
Comment options

@sharadmv
Comment options

@BillHuang2001
Comment options

@sharadmv
Comment options

@mattjj
Comment options

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