Each operation in a TensorFlow graph is a NodeDef: a name, an op such as
Conv2D, the names of its inputs, and attributes that fix its types and
settings. Nodes appear in the GraphDef
and in the bodies of functions.
These messages are from TensorFlow’s node_def.proto and
attr_value.proto (syntax = "proto3", package
tensorflow, as on TensorFlow’s master branch in November 2026), so
repeated numbers are packed and maps are lists of entry messages; see the
Protocol Buffers
reference.
NodeDef
One node: its name, op, inputs, device and attributes.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | name | string | LEN | The node’s name, unique in the graph. The explorer requires one with no spaces or control characters. |
| 2 | op | string | LEN | The operation, such as Conv2D, Const or Placeholder, or the name of a function. The explorer requires letters, digits, _, ., > and - only. |
| 3 | input | repeated string | LEN, one per input | Inputs: node for its first output, node:1 for another, and ^node for a control input, which only orders the two nodes. |
| 4 | device | string | LEN | Where to run it, such as /device:GPU:0; often empty. |
| 5 | attr | map<string, AttrValue> | LEN, one per entry | The op’s attributes, as entries. |
| 6 | experimental_debug_info | ExperimentalDebugInfo | LEN | The nodes and functions it came from. |
| 7 | experimental_type | FullTypeDef | LEN | Its full type. The explorer does not include this message and shows it by number. |
A node with op Const, built for this page, with two attributes:
| Bytes | Meaning |
|---|---|
0A 01 77 | name: w |
12 05 43 6F 6E 73 74 | op: Const |
2A 0B 0A 05 64 74 79 70 65 12 02 30 01 | attr entry: key dtype, value an AttrValue with type (field 6) = 1, DT_FLOAT |
2A 1D 0A 05 76 61 6C 75 65 12 14 42 12 … | attr entry: key value, value an AttrValue with tensor (field 8), a TensorProto of 18 bytes |
08 01 12 04 12 02 08 02 22 08 00 00 80 3F 00 00 00 40 | The tensor: dtype DT_FLOAT, shape [2], tensor_content 1.0 and 2.0 |
NodeDef.AttrEntry
One attribute: the map entry that map<string, AttrValue> attr
becomes on the wire.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | key | string | LEN | The attribute’s name, such as T, dtype or strides. |
| 2 | value | AttrValue | LEN | Its value. |
NodeDef.ExperimentalDebugInfo
Where the node came from, kept when graphs are rewritten.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | original_node_names | repeated string | LEN, one per name | The names of the nodes it was made from. |
| 2 | original_func_names | repeated string | LEN, one per name | The functions those nodes were in. |
AttrValue
An attribute’s value. All fields form one oneof: exactly one is set.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 2 | s | bytes | LEN | Bytes, often text such as a padding mode (SAME). |
| 3 | i | int64 | VARINT | An integer. |
| 4 | f | float | I32 | A float. |
| 5 | b | bool | VARINT | A bool. |
| 6 | type | DataType | VARINT | A data type, such as the T or dtype of an op. |
| 7 | shape | TensorShapeProto | LEN | A shape. |
| 8 | tensor | TensorProto | LEN | A tensor, such as the value of a Const node. |
| 1 | list | ListValue | LEN | A list of values of one of these kinds. |
| 10 | func | NameAttrList | LEN | A function and its attributes, such as the body of a While. |
| 9 | placeholder | string | LEN | Inside a function: the name of the caller’s attribute whose value this takes. |
AttrValue.ListValue
Lists of values. The numeric lists are packed.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 2 | s | repeated bytes | LEN, one per value | Byte strings. |
| 3 | i | repeated int64, packed | LEN | Integers, such as strides or ksize. |
| 4 | f | repeated float, packed | LEN | Floats. |
| 5 | b | repeated bool, packed | LEN | Bools. |
| 6 | type | repeated DataType, packed | LEN | Data types. |
| 7 | shape | repeated TensorShapeProto | LEN, one per value | Shapes. |
| 8 | tensor | repeated TensorProto | LEN, one per value | Tensors. |
| 9 | func | repeated NameAttrList | LEN, one per value | Functions. |
Field 1 is not used.
NameAttrList
A function name and the attributes to call it with.
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | name | string | LEN | The function’s name, in the graph’s library. |
| 2 | attr | map<string, AttrValue> | LEN, one per entry | Attributes, as entries. |
NameAttrList.AttrEntry
| Field | Name | Type | Wire type | Meaning |
|---|---|---|---|---|
| 1 | key | string | LEN | The attribute’s name. |
| 2 | value | AttrValue | LEN | Its value. |