Skip to content

Commit d74ad53

Browse files
committed
add parameter description
1 parent 9d7e166 commit d74ad53

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,30 @@ python setup.py sdist
4545
```
4646

4747
# Usage
48+
49+
To convert a TensorFlow model, tf2onnx expects a ```frozen TensorFlow graph``` and the user needs to specify inputs and outputs for the graph by passing the input and output
50+
names with ```--inputs INPUTS``` and ```--outputs OUTPUTS```.
51+
52+
Usage command:
4853
```
4954
python -m tf2onnx.convert --input SOURCE_FROZEN_GRAPH_PB\
5055
--inputs SOURCE_GRAPH_INPUTS\
5156
--outputs SOURCE_GRAPH_OUTPUS\
52-
[--output TARGET_ONNX_GRAPH\]
57+
[--output TARGET_ONNX_GRAPH]\
5358
[--target TARGET]\
5459
[--continue_on_error]\
5560
[--verbose]\
56-
[--opset OPSET]
61+
[--opset OPSET]
5762
```
58-
For example, run following commands in tensorflow-onnx root directory:
63+
64+
Parameters:
65+
- input: frozen TensorFlow graph, which can be got with [freeze graph tool](#freeze_graph).
66+
- output: the target onnx file path.
67+
- inputs/outputs: Tensorflow graph's input/output names, which can be got with [summarize graph tool](#summarize_graph).
68+
- target: There are different onnx versions and workarounds for runtimes that can be set with ```--target TARGET```. The default is onnx-1.1 and caffe2 which generates a graph
69+
that can be executed on a onnx-1.0/onnx-1.1 runtime, like caffe2 and winml.
70+
71+
Usage example (run following commands in tensorflow-onnx root directory):
5972
```
6073
python -m tf2onnx.convert\
6174
--input tests/models/fc-layers/frozen.pb\
@@ -65,12 +78,13 @@ python -m tf2onnx.convert\
6578
--verbose
6679
```
6780

68-
To convert a TensorFlow model, tf2onnx expects a ```frozen TensorFlow graph``` and the user needs to specify inputs and outputs for the graph by passing the input and output
69-
names with ```--inputs INPUTS``` and ```--outputs OUTPUTS```.
81+
## <a name="summarize_graph"></a>Tool to Get Graph Inputs & Outputs
82+
7083
To find the inputs and outputs for the TensorFlow graph the model developer will know or you can consult TensorFlow's [summarize_graph](https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/graph_transforms) tool, for example:
7184
```
7285
summarize_graph --in_graph=tests/models/fc-layers/frozen.pb
7386
```
87+
## <a name="freeze_graph"></a>Tool to Freeze Graph
7488

7589
The TensorFlow tool to freeze the graph is [here](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py).
7690

@@ -85,8 +99,6 @@ python -m tensorflow.python.tools.freeze_graph \
8599
--output_graph=tests/models/fc-layers/frozen.pb
86100
```
87101

88-
There are different onnx versions and workarounds for runtimes that can be set with ```--target TARGET```. The default is onnx-1.1 and caffe2 which generates a graph
89-
that can be executed on a onnx-1.0/onnx-1.1 runtime, like caffe2 and winml.
90102

91103
# Testing
92104
There are 2 types of tests.

0 commit comments

Comments
 (0)