Save a SavedObjectGraph proto for `root`.
(saveable_view, asset_file_def_index)
| 611 | |
| 612 | |
| 613 | def _serialize_object_graph(saveable_view, asset_file_def_index): |
| 614 | """Save a SavedObjectGraph proto for `root`.""" |
| 615 | # SavedObjectGraph is similar to the TrackableObjectGraph proto in the |
| 616 | # checkpoint. It will eventually go into the SavedModel. |
| 617 | proto = saved_object_graph_pb2.SavedObjectGraph() |
| 618 | saveable_view.fill_object_graph_proto(proto) |
| 619 | |
| 620 | coder = nested_structure_coder.StructureCoder() |
| 621 | for concrete_function in saveable_view.concrete_functions: |
| 622 | serialized = function_serialization.serialize_concrete_function( |
| 623 | concrete_function, saveable_view.captured_tensor_node_ids, coder) |
| 624 | if serialized is not None: |
| 625 | proto.concrete_functions[concrete_function.name].CopyFrom( |
| 626 | serialized) |
| 627 | |
| 628 | for obj, obj_proto in zip(saveable_view.nodes, proto.nodes): |
| 629 | _write_object_proto(obj, obj_proto, asset_file_def_index) |
| 630 | return proto |
| 631 | |
| 632 | |
| 633 | def _write_object_proto(obj, proto, asset_file_def_index): |
no test coverage detected