Skip to content

(Interpreter idioms for lax primitives like lax.cond) Apply interpreters across branches - what happens to literals in branches? #14109

Answered by mattjj
femtomc asked this question in Q&A
Discussion options

You must be logged in to vote

Sounds like you're cooking up something cool!

IIUC, you're asking why 0.0 and 2.0 don't show up in closed_jaxpr.literals, right?

If so, it's just a result of confusing naming choices. We named the attribute on ClosedJaxpr "literals" because:

  1. we were tired of using "consts" everywhere, and
  2. we wanted to underscore that that field could never contain Tracers, and had to contain raw array-like stuff.

(Speaking of confusing names, ClosedJaxpr should really be called PartiallyAppliedJaxpr...)

But actual literals, as in constants whose values appear directly in the program data structure, don't go in in that field at all. They go somewhere else.

There's another kind of object called core.Literal

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