You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tensorflow-onnx will use the onnx version installed on your system and installs the latest onnx version if none is found.
7
+
tensorflow-onnx will use the ONNX version installed on your system and installs the latest ONNX version if none is found.
8
8
9
-
By default we use opset 7 for the resulting onnx graph since most runtimes will support opset 7. Opset 7 was introduced in onnx-1.2.
9
+
By default we use opset 7 for the resulting ONNX graph since most runtimes will support opset 7. Opset 7 was introduced in onnx-1.2.
10
10
11
-
With the release of onnx-1.3 there is now opset 8 - to create an onnx graph for opset 8 use in the command line ```--opset 8```.
11
+
Newer releases of ONNX support higher opsets. For example, to create an ONNX graph for opset 8 use in the command line ```--opset 8```.
12
12
13
13
# Status
14
14
We support many TensorFlow models. Support for Fully Connected and Convolutional networks is mature. Dynamic LSTM/GRU/Attention networks should work but the code for this is evolving.
@@ -73,17 +73,16 @@ python -m tf2onnx.convert
73
73
--graphdef SOURCE_GRAPHDEF_PB
74
74
--checkpoint SOURCE_CHECKPOINT
75
75
--saved-model SOURCE_SAVED_MODEL
76
+
[--output TARGET_ONNX_MODEL]
76
77
[--inputs GRAPH_INPUTS]
77
78
[--outputs GRAPH_OUTPUS]
78
79
[--inputs-as-nchw inputs_provided_as_nchw]
80
+
[--opset OPSET]
79
81
[--target TARGET]
80
-
[--output TARGET_ONNX_GRAPH]
81
-
[--target TARGET]
82
-
[--continue_on_error]
83
-
[--verbose]
84
82
[--custom-ops list-of-custom-ops]
85
-
[--opset OPSET]
86
83
[--fold_const]
84
+
[--continue_on_error]
85
+
[--verbose]
87
86
```
88
87
89
88
## Parameters
@@ -100,10 +99,10 @@ the target onnx file path.
100
99
Tensorflow model's input/output names, which can be found with [summarize graph tool](#summarize_graph). Those names typically end on ```:0```, for example ```--inputs input0:0,input1:0```. inputs and outputs are ***not*** needed for models in saved-model format.
101
100
### --inputs-as-nchw
102
101
By default we preserve the image format of inputs (nchw or nhwc) as given in the TensorFlow model. If your hosts (for example windows) native format nchw and the model is written for nhwc, ```--inputs-as-nchw``` tensorflow-onnx will transpose the input. Doing so is convinient for the application and the converter in many cases can optimize the transpose away. For example ```--inputs input0:0,input1:0 --inputs-as-nchw input0:0``` assumes that images are passed into ```input0:0``` as nchw while the TensorFlow model given uses nhwc.
103
-
### --target
104
-
Some runtimes need workarounds, for example they don't support all types given in the onnx spec. We'll workaround it in some cases by generating a different graph. Those workarounds are activated with ```--target TARGET```.
105
102
### --opset
106
-
by default we uses the newest opset 7 to generate the graph. By specifieing ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 5``` would create a onnx graph that uses only ops available in opset 5. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
103
+
By default we use the opset 7 to generate the graph. By specifying ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 5``` would create a onnx graph that uses only ops available in opset 5. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
104
+
### --target
105
+
Some models require special handling to run on some runtimes. In particular, the model may use unsupported data types. Workarounds are activated with ```--target TARGET```. Currently supported values are listed on this [wiki](https://github.com/onnx/tensorflow-onnx/wiki/target). If your model will be run on Windows ML, you should specify the appropriate target value.
107
106
### --custom-ops
108
107
the runtime may support custom ops that are not defined in onnx. A user can asked the converter to map to custom ops by listing them with the --custom-ops option. Tensorflow ops listed here will be mapped to a custom op with the same name as the tensorflow op but in the onnx domain ai.onnx.converters.tensorflow. For example: ```--custom-ops Print``` will insert a op ```Print``` in the onnx domain ```ai.onnx.converters.tensorflow``` into the graph. We also support a python api for custom ops documented later in this readme.
109
108
### --fold_const
@@ -163,7 +162,7 @@ optional arguments:
163
162
--config yaml config file
164
163
--verbose verbose output, option is additive
165
164
--opset OPSET target opset to use
166
-
--perf csv-file capture performance numbers or tensorflow and onnx runtime
165
+
--perf csv-file capture performance numbers for tensorflow and onnx runtime
167
166
--debug dump generated graph with shape info
168
167
--fold_const when set, TensorFlow fold_constants transformation will be applied before conversion. This will benefit features including Transpose optimization (e.g. Transpose operations introduced during tf-graph-to-onnx-graph conversion will be removed), and RNN unit conversion (for example LSTM).
0 commit comments