When exactly is setup() called for linen modules? #1038
Unanswered
davisyoshida
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a module which uses
jax.jitin itssetup(), under the assumption that setup will only be called when I callmodel.init. However, by logging the calls tosetup()I found that it was called not just when I initialize the model, but also later when I use itsapply(). I found this very unexpected, is there some documentation on what all will trigger a call tosetup()?(The reason I was jitting the function inside setup is that it depends on submodules, and
jax.jit()doesn't like modules as static args since they can't be hashed, so I figured I'd make it in a closure where the submodules were accessible)Beta Was this translation helpful? Give feedback.
All reactions