![]() ![]() In this situation the Sequential was a submodule of another main module and the main module just used it as is, it didn't investigate if it is a collection that it should loop over - a common setup. Why use nn.Sequental at all? Why not loop through a Python list (or dict) of nn.Modules? I'm mostly worried whether there's some PyTorch composability feature we're lacking. Alternatively, we can explicitly support only dict and OrderedDict, knowing both of these will be ordered. Expand nn.Sequential support to handle Mappings in addition to OrderedDicts, following natural ordering of the mappingįor both of these, it may be too weird semantically to handle arbitrary Mappings (although for full consistency among modules, we should either do this or make a BC-breaking change to the others to stop handling arbitrary Mappings, which is harder).Make the BC-breaking change in nn.ParameterDict -> treat Mappings the same way as OrderedDicts (follow natural ordering).Not sure I see the benefit to doing this. ![]() all of the internal module state is currently stored in OrderedDicts). purge OrderedDict) from the module code entirely, we'd have to swap types in much more places (e.g. It's already inconsistent with nn.ModuleDict, so I think a BC-breaking change to bring it in line makes sense.įor a full global change (i.e. TL DR: It looks like nn.ParameterDict is the only current place that OrderedDicts are explicitly treated differently than dicts or other Mappings. load_state_dict(): accepts a Mapping and follows its ordering (no BC-breaking change needed).Constructor / update() method: accepts dicts or OrderedDicts, and treats them differently (BC-breaking change needed to stop sorting for the case of dict).Constructor / update() method: accepts dicts or OrderedDicts, but treats them the same (no BC-breaking change needed).Constructor: doesn't accept dict now -> change to accept dict, following dict ordering with no sorting (not BC-breaking because this errors now).I see the following areas within modules that currently interact with dict-likes in public APIs:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |