Solved by ptrblck in post #2 
              
              
                The bias parameter is automatically added to nn.Linear, if you don’t explicitly set bias=False in its creation. 
To add a regularization term for the weight parameter, you could manually add it to the loss: 
output = model(input)
loss = criterion(output, target)
loss = loss + torch.norm(model.layer.…