[docs]classSequential(Module):""" A sequential model that applies a list of ModuleMaps to the input in order. :param in_keys: The keys that are assumed to be in the input tensor map in the :py:meth:`forward` function. :param args: A list of :py:class:`ModuleMap` objects that will be applied in order to the input tensor map in the :py:meth:`forward` function. """def__init__(self,in_keys:Labels,*args:List[ModuleMap]):super().__init__()ifnotis_metatensor_class(in_keys,Labels):raiseTypeError("`in_keys` must be a `Labels` object.")modules:List[Module]=[]foriinrange(len(in_keys)):modules.append(torch.nn.Sequential(*[arg.module_map[i]forarginargs]))self.module_map=ModuleMap(in_keys,modules,out_properties=args[-1].module_map.out_properties)
[docs]defforward(self,tensor:TensorMap)->TensorMap:""" Apply the transformations to the input tensor map `tensor`. """returnself.module_map(tensor)