flax.linen.module.init still fails under dynamic type checking for nested modules #3756
Labels
Priority: P2 - no schedule
Best effort response and resolution. We have no plan to work on this at the moment.
Related issue: #3224
While the snippet posted in that issue does work now, there still seems to be a failure mode when nested modules (all of which are runtime type checked) are used.
Colab Link
This snippet fails with the following error:
Looking at nn.Module's _ParentType, indeed the type of the argument to
parent
is expected to beType[nn.Module]
so a class, rather than an instance ofnn.Module
which is what is actually being passed in. This seems to have been the problem for the previously reported instance of this issue in #3224 , since the PR that fixes it (#3371) changed the type annotation fromType[Scope]
to simplyScope
, to adjust the expectation from a class being provided to an instance.The text was updated successfully, but these errors were encountered: