If you use all model’s parameters in your optimizer, it’s the same.
optimizer = torch.optim.Adam(net1.parameters()

However, if you just use a subset of the model’s parameters in your optimizer, it will be clearly different.