I have a function
init_from_checkpoint(
ckpt_dir_or_file,
assignment_map)
where assignment_map supports following syntax:
'checkpoint_scope_name/': 'scope_name/' - will load all variables in current scope_name from checkpoint_scope_name with matching tensor names.
For example,
init_from_checkpoint('/tmp/model.ckpt',
                     {'old_scope_1/var1': 'new_scope_1/var1',
                      'old_scope_1/var2': 'new_scope_1/var2'})
Right now, I have two list
old_scope_1_list=[old_scope_1/var1, old_scope_1/var2, ...,old_scope_1/var100]
new_scope_1_list=[new_scope_1/var1, new_scope_1/var2, ...,new_scope_1/var100]
How could I call the function init_from_checkpoint using old_scope_1_list and new_scope_1_list to make the calling function effectively in python? My current solution is that write 100 lines as bellow without using the two lists, but it looks ineffective way
init_from_checkpoint('/tmp/model.ckpt',
                         {'old_scope_1/var1': 'new_scope_1/var1',
                          'old_scope_1/var2': 'new_scope_1/var2',
                          ...
                          'old_scope_1/var100': 'new_scope_1/var100'})
 
    