In TensorFlow, I found that I can do the following,
from tensorflow.core import framework from google.protobuf import json_format graph_def = framework.graph
I believe you are looking for a way to set message fields inside of the GraphDef and NodeDef protos. How to modify ProtoBuf objects in Python is detailed here
GraphDef
NodeDef