@@ -19,7 +19,7 @@ public static MetaGraphDef read_meta_graph_file(string filename)
1919 return meta_graph_def ;
2020 }
2121
22- public static ( Dictionary < string , RefVariable > , ITensorOrOperation [ ] ) import_scoped_meta_graph_with_return_elements ( MetaGraphDef meta_graph_or_file ,
22+ public static ( Dictionary < string , VariableV1 > , ITensorOrOperation [ ] ) import_scoped_meta_graph_with_return_elements ( MetaGraphDef meta_graph_or_file ,
2323 bool clear_devices = false ,
2424 string import_scope = "" ,
2525 Dictionary < string , Tensor > input_map = null ,
@@ -61,7 +61,7 @@ public static (Dictionary<string, RefVariable>, ITensorOrOperation[]) import_sco
6161 return_elements : return_elements ) ;
6262
6363 // Restores all the other collections.
64- var variable_objects = new Dictionary < ByteString , RefVariable > ( ) ;
64+ var variable_objects = new Dictionary < ByteString , VariableV1 > ( ) ;
6565 foreach ( var col in meta_graph_def . CollectionDef . OrderBy ( x => x . Key ) )
6666 {
6767 // Don't add unbound_inputs to the new graph.
@@ -83,11 +83,14 @@ public static (Dictionary<string, RefVariable>, ITensorOrOperation[]) import_sco
8383 {
8484 foreach ( var value in col . Value . BytesList . Value )
8585 {
86- RefVariable variable = null ;
86+ VariableV1 variable = null ;
8787 if ( ! variable_objects . ContainsKey ( value ) )
8888 {
8989 var proto = VariableDef . Parser . ParseFrom ( value ) ;
90- variable = new RefVariable ( variable_def : proto , import_scope : scope_to_prepend_to_names ) ;
90+ if ( proto . IsResource )
91+ variable = new ResourceVariable ( variable_def : proto , import_scope : scope_to_prepend_to_names ) ;
92+ else
93+ variable = new RefVariable ( variable_def : proto , import_scope : scope_to_prepend_to_names ) ;
9194 variable_objects [ value ] = variable ;
9295 }
9396 variable = variable_objects [ value ] ;
@@ -126,9 +129,9 @@ public static (Dictionary<string, RefVariable>, ITensorOrOperation[]) import_sco
126129 }
127130 }
128131
129- var variables = graph . get_collection < RefVariable > ( ops . GraphKeys . GLOBAL_VARIABLES ,
132+ var variables = graph . get_collection < VariableV1 > ( ops . GraphKeys . GLOBAL_VARIABLES ,
130133 scope : scope_to_prepend_to_names ) ;
131- var var_list = new Dictionary < string , RefVariable > ( ) ;
134+ var var_list = new Dictionary < string , VariableV1 > ( ) ;
132135 variables . ForEach ( v => var_list [ ops . strip_name_scope ( v . name , scope_to_prepend_to_names ) ] = v ) ;
133136
134137 return ( var_list , imported_return_elements ) ;
0 commit comments