From here,
There are a few ways to get a list of the OpDefs for the registered ops:
- TF_GetAllOpList in the C API retrieves all registered OpDef protocol messages. This can be used to write the generator in the client language. This requires that the client language have protocol buffer support in order to interpret the OpDef messages.
- The C++ function OpRegistry::Global()->GetRegisteredOps() returns the same list of all registered OpDefs (defined in [tensorflow/core/framework/op.h]). This can be used to write the generator in C++ (particularly useful for languages that do not have protocol buffer support).
- The ASCII-serialized version of that list is periodically checked in to [tensorflow/core/ops/ops.pbtxt] by an automated process.
But alas, I want to do this in Python like,
import tensorflow as tf
from google.protobuf import json_format
json_string = json_format.MessageToJson(tf.GetAllOpsList())
I want a way to get the Protobuf message for every operation in Tensorflow so that I can dump it as JSON via