The file saved_model.pb is one SavedModel message, from
TensorFlow’s saved_model.proto (syntax = "proto3", package
tensorflow). It has only two fields; everything else is inside its meta
graphs. For the bytes of tags and lengths, see the
Protocol Buffers reference.
SavedModel
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | saved_model_schema_version | int64 | VARINT | The version of the SavedModel format. It is 1 in every TensorFlow version so far. |
| 2 | meta_graphs | repeated MetaGraphDef | LEN, one per meta graph | The meta graphs, each told apart by its tags, such as serve or train. There must be at least one. |
A small file
This 21-byte saved_model.pb was built for this page. It has one meta
graph with the tag serve and a TensorFlow version, and nothing else; a
real file goes on to hold the graph, the signatures and, in TensorFlow 2, the object
graph, inside the same meta graph.
08 01 12 11 0A 0F 22 05 73 65 72 76 65 2A 06 32 2E 31 35 2E 30
| Bytes | Meaning |
|---|---|
08 01 | Field 1, saved_model_schema_version: 1. |
12 11 | Field 2, meta_graphs: a MetaGraphDef of 17 bytes. |
0A 0F | Inside: field 1, meta_info_def, 15 bytes. |
22 05 73 65 72 76 65 | Inside that: field 4, tags: serve. |
2A 06 32 2E 31 35 2E 30 | Field 5, tensorflow_version: 2.15.0. |
What the explorer checks
The parser for this format takes only fields 1 and 2 at the top level, each with its own wire type, and requires at least one meta graph. It then reads the meta graphs, and the GraphDef, nodes and tensors inside them, against their schemas, checking the first 20,000 fields. For each meta graph it shows the tags and the TensorFlow version, then every signature with its inputs and outputs, and for the first meta graph the GraphDef version, every node and the ops used, and the functions of the library.