Try seeing if model.parameters() gives you all the parameters you are expecting. Maybe you have defined some of the parameters as Variable instead of nn.Parameter, so the logic behind parameters() can’t see your weights.