you can select model parameter with model.named_parameters(). This can be something like below. I dont try it but shows general syntax
for net1,net2 in zip(A.named_parameters(),B.named_parameters()):
                net2[1].data.grad = net1[1].data.grad