pytorch net creation does not generate weights if done in a list
I'm creating a net in pytorch by writing a class called MyNet with init() and forward() method.
If I create a layer in init() like:

self.fc = nn.Linear(5, 10)

everything works fine and 

net = MyNet()
paramL = list(net.parameters())


gives me a list with some weights inside.
However, if I create layers in the following way

self.layerL = [nn.Linear(5,10)]


something seems to go wrong, since list(net.parameters()) now gives an empty list :-(

Any idea what I'm doing wrong ??

Many thanks 

In simple terms, this is because it is not a torch.nn object.
For this use torch.nn.Sequential. For example,

self.Layer = torch.nn.Sequential(nn.Linear(5,10), nn.Linear(10,10), ...)
