Questions regarding pbtxt format

I am trying to read a .pbtxt file and have two questions regarding the following section:

node {
  name: "bert/embeddings/Slice/begin"
  op: "Const"
  input: "^bert/embeddings/assert_less_equal/Assert/Assert"
  ...
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_INT32
        tensor_shape {
          dim {
            size: 2
          }
        }
        tensor_content: "\000\000\000\000\000\000\000\000"
      }
    }
  }
}
  1. Why does a Const node have an input? Is the value not defined by the attr part of this node?
  2. What does the ^ mean at the beginning of the input field?
  3. Is there documentation available for the TensorFlow pbtxt format? I was not able to find anything.

Many thanks for your help in advance.

  1. It could be a “control input”, don’t run this op until after this other op. That would make sense given that the other is an assert.
  2. IDK for sure but ^ likely indicates that it’s a control input. Checking a few other graph pbtxts, the regular inputs don’t have the ^.
  3. The pbtxt format is common to all protos, I think what you’re asking is more about the Graph proto that’s serialized here. To understand a proto, it always helps to start with the “.proto” file. In this case you want to look at: tensorflow/graph.proto at master · tensorflow/tensorflow · GitHub
2 Likes