mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-27 17:54:55 +08:00
[jit] Make ModuleLists a sugared value (#34320)
Summary: Previously when emitting subscripts we only emitted actual values, but now they may sometimes emit a `ModuleValue`, so it should stay as a `SugaredValue`. This allows for the result of the subscript to be treated as a real module (i.e. you can just do `self.modlist[1](inputs)` instead of `self.modlist[1].forward(inputs)`) Pull Request resolved: https://github.com/pytorch/pytorch/pull/34320 Pulled By: driazati Differential Revision: D20345642 fbshipit-source-id: 2bedf9a454af747b704422f6bbb8370cbdf4bf61
This commit is contained in:
committed by
Facebook Github Bot
parent
c218963270
commit
2c0f3536b6
@ -227,7 +227,7 @@ SugaredValuePtr ModuleValue::getitem(
|
||||
return getSugaredModuleDict(loc, m)->getModules()->getitem(loc, m, idx);
|
||||
}
|
||||
throw ErrorReport(loc)
|
||||
<< "Only ModuleLists, Sequentials, and ModuleDict Modules are subscriptable";
|
||||
<< "Only ModuleList, Sequential, and ModuleDict modules are subscriptable";
|
||||
}
|
||||
|
||||
void checkInterface(
|
||||
|
||||
Reference in New Issue
Block a user