Is there any example code about copy variable parameters between two Program?
Created by: TheodoreG
Hey guys here I have an question, how to copy parameters between Programs? Suppose that I have defined two Programs and they have same structure in the last few layers, for example they both have two FC layers. While I print the variables I got:
For program A: [u'fc1.b_0', u'fc1.tmp_0', u'fc1.tmp_1', u'fc1.w_0', u'fc2.b_0', u'fc2.tmp_0', u'fc2.tmp_1', u'fc2.tmp_2', u'fc2.w_0', u'feature', u'label', u'mean_0.tmp_0', u'top_k_0.tmp_0', u'top_k_0.tmp_1', u'top_k_1.tmp_0', u'top_k_1.tmp_1']
For program B: [ ..........(many other layers)......, u'fc1.b_1', u'fc1.tmp_2', u'fc1.tmp_3', u'fc1.w_1', u'fc2.b_1', u'fc2.tmp_3', u'fc2.tmp_4', u'fc2.tmp_5', u'fc2.w_1', u'feature.tmp_0', u'feature.tmp_1', u'image', u'label', u'mean_1.tmp_0', u'pool2d_0.tmp_0', u'pool2d_1.tmp_0', u'top_k_2.tmp_0', u'top_k_2.tmp_1', u'top_k_3.tmp_0', u'top_k_3.tmp_1']
Now I know exactly those the FC layers in two Programs share same structure and just have different variable name. How can I copy the parameter of 'fc1.b_0' of Program A into 'fc1.b_1' of Program B and so on?