-
Hi all! I'm working on a transformation which uses an interpreter and a set of rules to parametrize the functionality on primitives. Working with straight line programs, I've run into no problems with my interpreter. However, I'm trying to extend the transformation to operate on The right thing I think here is to apply the interpreter to each branch (keeping the return values consistent, as expected) -- and then return a value again using However, I'm running into issues for certain branch functions -- like the following: { lambda ; a:f32[]. let b:f32[] = div a 2.0 in (b,) }
{ lambda ; a:f32[]. let in (0.0,) } Imagine I'm writing a forward mode AD interpreter which lifts values to However, when I try and inspect the
This seems weird to me because 2.0 is a literal, and so is 0.0 -- and then when I apply the transform and use the result in a new Any ideas why this occurs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Sounds like you're cooking up something cool! IIUC, you're asking why If so, it's just a result of confusing naming choices. We named the attribute on
(Speaking of confusing names, 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 Does that make sense? Let me know if I'm misunderstanding! |
Beta Was this translation helpful? Give feedback.
Sounds like you're cooking up something cool!
IIUC, you're asking why
0.0
and2.0
don't show up inclosed_jaxpr.literals
, right?If so, it's just a result of confusing naming choices. We named the attribute on
ClosedJaxpr
"literals
" because:consts
" everywhere, andTracer
s, and had to contain raw array-like stuff.(Speaking of confusing names,
ClosedJaxpr
should really be calledPartiallyAppliedJaxpr
...)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
…