Does something inspired from:

  
    
    
    Copy weights only from a network's parameters 
  
  
    I think you can do something like 
params1 = model1.named_parameters()
params2 = model2.named_parameters()

dict_params2 = dict(params2)

for name1, param1 in params1:
    if name1 in dict_params2:
        dict_params2[name1].data.copy_(param1.data)
  


or

  
      stackoverflow.com
  
  
      
    
  

  Take the average of the weights of two networks in PyTorch 125



  python, neural-network, deep-learning, weight



  asked by
  
  
    patapouf_ai
  
  on 10:15AM - 01 Feb 18


  
  
    
    
  
  


not work for you?