Add Keras metadata proto.

The metadata of each Keras model/layer will be moved from the SavedModel to a separate keras.metadata file.

PiperOrigin-RevId: 337394096
Change-Id: Iccba44c8478e038fc9de036313c2e7e88fd5605d
This commit is contained in:
Katherine Wu 2020-10-15 15:22:07 -07:00 committed by TensorFlower Gardener
parent 548872a51d
commit 4ad4b488c9
2 changed files with 40 additions and 0 deletions
tensorflow/python/keras/protobuf

View File

@ -14,3 +14,10 @@ tf_proto_library(
srcs = ["projector_config.proto"],
cc_api_version = 2,
)
tf_proto_library(
name = "saved_metadata_proto",
srcs = ["saved_metadata.proto"],
cc_api_version = 2,
protodeps = ["//tensorflow/core:protos_all"],
)

View File

@ -0,0 +1,33 @@
// Protobuf containing the metadata for each Keras object saved in a SavedModel.
syntax = "proto3";
package third_party.tensorflow.python.keras.protobuf;
import "tensorflow/core/framework/versions.proto";
message SavedMetadata {
// Nodes represent trackable objects in the SavedModel. The data for every
// Keras object is stored.
repeated SavedObject nodes = 1;
}
// Metadata of an individual Keras object.
message SavedObject {
// Version defined by the code serializing this Keras object.
.tensorflow.VersionDef version = 1;
// Index of the node in the SavedModel SavedObjectGraph.
int32 node_id = 2;
// String path from root (e.g. "root.child_layer")
string node_path = 3;
// Identifier to determine loading function.
// Currently supported identifiers:
// _tf_keras_layer, _tf_keras_input_layer, _tf_keras_rnn_layer,
// _tf_keras_metric, _tf_keras_network, _tf_keras_model,
// _tf_keras_sequential
string identifier = 4;
// Metadata containing a JSON-serialized object with the non-TensorFlow
// attributes for this Keras object.
string metadata = 5;
}