Skip to content

Linen: error with self.name in setup function #765

Answered by avital
Daulbaev asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Daulbaev -- there are two issues here:

  1. The error message is misleading
  2. Indeed, in setup, we attach submodules directly during assignment (via __setattr__). So Linen doesn't "see" the modification done with +=. There have been a few proposals for making this clearer, including: (a) making assigned values read only after assignment, (b) requiring the use of ModuleList, where we could then override __iadd__, (c) automatically converting assigned values to ModuleLists with that functionality.

Replies: 2 comments 1 reply

Comment options

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

Answer selected by Daulbaev
Comment options

You must be logged in to vote
0 replies
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
Converted from issue

This discussion was converted from issue #765 on December 24, 2020 14:54.