-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tracing through __getitem__ -> __len__ for ModuleList fails. #126445
Comments
Ok I looked at this, and here is whats happening:
we need to call getitem but this is special handled in pytorch/torch/_dynamo/variables/nn_module.py Line 600 in 796dff7
and we do not trace through getitem for ModuleList.
and we fail to trace through the length call. |
basically we fail exactly here:
|
I think the issue is that self._module is a dictionary but we represent that as GetAttrVariable instead of ConstDictVariable, but i do now know if we its constant and if we can use ConstDictVariable, the type of _module is _modules: Dict[str, Module] # type: ignore[assignment] |
python test/dynamo/test_dynamic_shapes.py -k DynamicShapesNNModuleTests.test_modulelist_dynamic_shapes
cc @ezyang @msaroufim @bdhirsh @anijain2305 @chauhang @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng
The text was updated successfully, but these errors were encountered: