Created
August 11, 2016 17:50
-
-
Save yaroslavvb/16bb81fcfb0932169087add47ecb8c3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
from tensorflow.core.framework import op_def_pb2 | |
from google.protobuf import text_format | |
def get_op_types(op): | |
for attr in op.attr: | |
if attr.type != 'type': | |
continue | |
return list(attr.allowed_values.list.type) | |
return [] | |
# directory where you did "git clone" | |
tensorflow_git_base = "/Users/yaroslavvb/tensorflow_main.git" | |
ops_file = tensorflow_git_base+"/tensorflow/tensorflow/core/ops/ops.pbtxt" | |
ops = op_def_pb2.OpList() | |
text_format.Merge(open(ops_file).read(), ops) | |
for op in ops.op: | |
# get templated string types | |
if tf.string in get_op_types(op): | |
print op.name, op.summary | |
for arg in op.input_arg: | |
if arg.type == tf.string: | |
print op.name, op.summary | |
break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment