Tensorflow Protocol Buffer

Tensorflow protocol buffer is huge :O

But, when you save your tensorflow model with the manner that lmnet repostitory defines, It will refer Graphdef & Nodedef object which will be defined on [link1].

To let this library 3rd-party independent, a set of protobuf is put on a ./model/pb/tf,py & ./model/pb/onnx.py

Following is a bit of exaplantions about its sturcutre.

Under Graphdef object, it has 4 fields, namely op , name , ìnput and attr

op

This field is used for identifing an operation which is supposed to be performed.
Note that they are not always identical to what is defined by tensorflow function when they are trained.

name

This field is a unique name on a graph which will identify a node given by a scope and sort of operation.
Since there is no overlapping on a single graph, they are used for having reference from another node to set an edge between them.
By and large, you can regard it as a function pointer.

input

Input is a list which contains names of different nodes. With tables of name, it contributes to build tree structure from a protocol buffer.

attr

Attr is a map which is a set of necessary information when a function runs.
These sets of information are tagged with op, for instance, Conv2D op has [ data_format , use_cudnn_on_gpu , padding , strides ].
I am not sure if all of attributes are dynamically allocated on a stack frame, but you can say these are sort of auto-variable by contrast with values on a Const node.
Type information of them are provided with them, but not as formalized as the one on ONNX.
Tensorflow-pb often provides values as an argument .

Example

Followings are op , name and attributes of lmnet classification model.

They are analysed by scripts ./tf_onnx/interface_/in_/tf.py