You can manually set the weights parameters equal to the weights from another layer (if the shapes are the same!):
l1 = nn.Linear(5, 5)
l2 = nn.Linear(5, 5)

l2.weight = l1.weight
l2.bias= l1.bias

The gradients will be calculated for both weight parameters together!