Getting parameters of specific layers in cvae

I need to get the parameters of all layers of a conditional variational autoencoder EXCEPT the parameters of the first layer.
Any suggestions?

Most likely you haven’t properly registered the first layer, so make sure it’s a subclass of nn.Module and either directly assigned to an attribute or to e.g. nn.ModuleList or nn.ModuleDict.

Thanks for your reply but I think there is a misunderstanding. I did not mean that I do not get the parameters of the first layer while calling model.parameters() for example, I meant what I want to do is to get all the parameters without the parameters of the first layer, in other words, I need to do some processes on the parameters of the model starting from the second layer.

You are right, I thought you see all parameters “except” the ones from the first layer.
In this case, you might want to filter the parameters of the first layer out e.g. via using their name attribute via model.named_parameters().

1 Like