Hy @Kunal_Dapse, I would highly recommend you read some tutorials first, you’re totaly misunderstanding me here. The way we construct models in pytorch is by inheriting them through nn.Module class.
Something like this
import torch.nn as nn
class Net(nn.Module):
       nn.Linear(input_channels,output_channels)
       /// Further layer.

Now I  have declared a single Linear (MLP) inside my model using torch.nn.Linear, this layer contains all the attributes an MLP should have, weights bias etc.
Which we can later access like this which I explained first.



 Usama_Hasan:

model.layer[index].weight


Now, for this what you can do is.



 Kunal_Dapse:

But I am trying to create the list of weights assigned which I couldn’t do it


You can append these weights in a list during training and access them later.



 Kunal_Dapse:

            self.W += (torch.mm(v0.t(), ph0) - torch.mm(vk.t(), phk)).t()