Solved by roylight in post #7 
              
              
                Hi thank you. I found a method in this question. [resolved] Implementing MAML in PyTorch They use the the modules such as functional.linear which has portable weights to achieve this effect. It is a little bit complicated because I have to manually modify the weight. But it seems to work.