@ChickenTarm Thanks for the reply. I tried using the torch.nn.ModuleDict, but it did not work since the class instances of  MultiModalEmbeddingLayer are not layers themselfves. This class has an attribute in which all the layers are stored.