The documentation for nn.Sequential mentions the following signature: torch.nn.Sequential(*arg: OrderedDict[str, Module])
.
However:
>>> from collections import OrderedDict
>>> import torch
>>> torch.nn.Sequential(arg=OrderedDict({"foo": torch.nn.Identity()}))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Sequential.__init__() got an unexpected keyword argument 'arg'
If nn.Sequential
was a regular Python class I could use arg
as a keyword or a positional argument but it seems that is not the case here. I’m wondering if there is a specific rationale behind this API or if it is just “nobody did invest time to implement this”? Do you think it is worthwhile opening an issue in the github tracker?
Background: The current state makes it harder for me to instantiate a nn.Sequential
instance using hydra + yaml.