Skip to content
Discussion options

You must be logged in to vote

Others might chime in, but in general the easiest approach to implement a custom transformation is using what we often call initial style: staging out to a jaxpr and using a jaxpr interpreter. The alternative is final style, implementing the transformation on-the-fly using a custom tracer. This is harder, but the advantage is often easier debuggability because the transformation happens within the context of the traced code, rather than as a post-processing step after it is traced. It also is more flexible, e.g. it allows for Python control flow to depend on traced data in some cases. But final-style transformations are somewhat more difficult to implement.

If you want to see a side-by-si…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by femtomc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants