1313using Tensorflow . Variables ;
1414using Tensorflow . Functions ;
1515using Tensorflow . Training . Saving . SavedModel ;
16+ using Tensorflow . Trackables ;
1617
1718namespace Tensorflow
1819{
@@ -51,9 +52,13 @@ public Loader(SavedObjectGraph object_graph_proto, SavedModel saved_model_proto,
5152 _node_filters = filters ;
5253 _node_path_to_id = _convert_node_paths_to_ints ( ) ;
5354 _loaded_nodes = new Dictionary < int , ( Trackable , Action < object , object , object > ) > ( ) ;
54- foreach ( var filter in filters )
55+
56+ if ( filters != null )
5557 {
56- _loaded_nodes [ _node_path_to_id [ filter . Key ] ] = filter . Value ;
58+ foreach ( var filter in filters )
59+ {
60+ _loaded_nodes [ _node_path_to_id [ filter . Key ] ] = filter . Value ;
61+ }
5762 }
5863
5964 _filtered_nodes = _retrieve_all_filtered_nodes ( ) ;
@@ -535,7 +540,13 @@ private void _add_object_graph_edges(SavedObject proto, int node_id)
535540 dependencies [ item . Key ] = nodes [ item . Value ] ;
536541 }
537542
538- return _recreate_default ( proto , node_id , dependencies ) ;
543+ return proto . KindCase switch
544+ {
545+ SavedObject . KindOneofCase . Resource => RestoredResource . deserialize_from_proto ( ) ,
546+ SavedObject . KindOneofCase . Asset => Asset . deserialize_from_proto ( ) ,
547+ SavedObject . KindOneofCase . Constant => TrackableConstant . deserialize_from_proto ( ) ,
548+ _ => _recreate_default ( proto , node_id , dependencies )
549+ } ;
539550 }
540551
541552 /// <summary>
@@ -549,7 +560,7 @@ private void _add_object_graph_edges(SavedObject proto, int node_id)
549560 return proto . KindCase switch
550561 {
551562 SavedObject . KindOneofCase . UserObject => _recreate_user_object ( proto . UserObject , node_id ) ,
552- SavedObject . KindOneofCase . Function => throw new NotImplementedException ( ) ,
563+ SavedObject . KindOneofCase . Function => _recreate_function ( proto . Function , null ) ,
553564 SavedObject . KindOneofCase . BareConcreteFunction => throw new NotImplementedException ( ) ,
554565 SavedObject . KindOneofCase . Variable => _recreate_variable ( proto . Variable ) ,
555566 SavedObject . KindOneofCase . CapturedTensor => throw new NotImplementedException ( )
@@ -609,6 +620,13 @@ private void _add_object_graph_edges(SavedObject proto, int node_id)
609620 }
610621 }
611622
623+ private ( ConcreteFunction , Action < object , object , object > ) _recreate_function ( SavedFunction proto ,
624+ Dictionary < Maybe < string , int > , Trackable > dependencies )
625+ {
626+ throw new NotImplementedException ( ) ;
627+ //var fn = function_deserialization.setup_bare_concrete_function(proto, )
628+ }
629+
612630 private ( ConcreteFunction , Action < object , object , object > ) _recreate_bare_concrete_function ( SavedBareConcreteFunction proto ,
613631 Dictionary < Maybe < string , int > , Trackable > dependencies )
614632 {
0 commit comments