Ha, thanks for the kind words @AbraMunna @Bibhabasu_Mohapatra
I assume you would like to create self.mX in a loop and also use a loop in the forward?
If var is returning a plain Python object, i.e. no PyTorch nn.Module, you could use setattr/getattr for both.
However, based on the usage in forward I would guess self.mX are modules, so using an nn.ModuleList would be the right approach here. Something like this should work:
class wrapper(nn.Module):
    def __init__(self, input_size, hidden_size, number_of_vars):
        super().__init__()
        self.module_list = nn.ModuleList()
        # assuming you want to create linear layers
        layer = nn.Linear
        for idx in range(number_of_vars):
            self.module_list.append(nn.Linear(input_size[idx], hidden_size))

    def forward(self, input_list):
        assert len(input_list)==len(self.module_list), "different lengths"
        out = [F.normalize(module(input)) for module, input in zip(self.module_list, input_list)]
        out = torch.cat(out, dim=1)
        return out

input_size = [2, 3, 4, 5, 6]
model = wrapper(input_size=input_size, hidden_size=16, number_of_vars=5)

batch_size = 4
input_list = [torch.randn(batch_size, s) for s in input_size]
out = model(input_list)