## Prerequisite
-Install tensorflow 1.x. It is tested with tensorflow 1.14.
-TensorFlow 2.x will not work since `contrib` is removed.
+Install tensorflow >= 1.12. It is tested with tensorflow 1.13, 1.14 and 2.0.
## Usage
tf.import_graph_def(graph_def, name='')
# identify inputs and outputs
- inputs = []
- inputs = [t for t in tf.contrib.framework.get_placeholders(graph)]
-
ops = graph.get_operations()
+ inputs = [op.outputs[0] for op in ops if op.type == "Placeholder"]
uses = {}
-
for op in ops:
uses[op.name] = 0
-
for op in ops:
for producer in op.inputs:
uses[producer.name.replace(':0', '')] = int(uses.get(producer.name, 0)) + 1
-
output_names = [k for k, v in uses.items() if v == 0]
# gen random input and run