Skip to content

Commit 880754e

Browse files
authored
Update the default opset version for tf2onnx. (#1946)
* Update the default opset version for tf2onnx. * Update README.md accordingly. Signed-off-by: Jay Zhang <jiz@microsoft.com>
1 parent d1993a7 commit 880754e

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The common issues we run into we try to document here [Troubleshooting Guide](Tr
2828
tf2onnx will use the ONNX version installed on your system and installs the latest ONNX version if none is found.
2929

3030
We support and test ONNX opset-9 to opset-15. opset-6 to opset-8 should work but we don't test them.
31-
By default we use ```opset-9``` for the resulting ONNX graph since most runtimes will support opset-9.
31+
By default we use ```opset-13``` for the resulting ONNX graph.
3232

3333
If you want the graph to be generated with a specific opset, use ```--opset``` in the command line, for example ```--opset 13```.
3434

@@ -98,9 +98,9 @@ To get started with `tensorflow-onnx`, run the `t2onnx.convert` command, providi
9898

9999
```python -m tf2onnx.convert --saved-model tensorflow-model-path --output model.onnx```
100100

101-
The above command uses a default of `9` for the ONNX opset. If you need a newer opset, or want to limit your model to use an older opset then you can provide the `--opset` argument to the command. If you are unsure about which opset to use, refer to the [ONNX operator documentation](https://github.com/onnx/onnx/releases).
101+
The above command uses a default of `13` for the ONNX opset. If you need a newer opset, or want to limit your model to use an older opset then you can provide the `--opset` argument to the command. If you are unsure about which opset to use, refer to the [ONNX operator documentation](https://github.com/onnx/onnx/releases).
102102

103-
```python -m tf2onnx.convert --saved-model tensorflow-model-path --opset 13 --output model.onnx```
103+
```python -m tf2onnx.convert --saved-model tensorflow-model-path --opset 15 --output model.onnx```
104104

105105
If your TensorFlow model is in a format other than `saved model`, then you need to provide the inputs and outputs of the model graph.
106106

@@ -118,7 +118,7 @@ You find an end-to-end tutorial for ssd-mobilenet [here](tutorials/ConvertingSSD
118118

119119
We recently added support for tflite. You convert ```tflite``` models via command line, for example:
120120

121-
```python -m tf2onnx.convert --opset 13 --tflite tflite--file --output model.onnx```
121+
```python -m tf2onnx.convert --opset 15 --tflite tflite--file --output model.onnx```
122122

123123
## CLI reference
124124

@@ -187,7 +187,7 @@ ONNX requires default values for graph inputs to be constant, while Tensorflow's
187187

188188
#### --opset
189189

190-
By default we use the opset 9 to generate the graph. By specifying ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 13``` would create a onnx graph that uses only ops available in opset 13. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
190+
By default we use the opset 13 to generate the graph. By specifying ```--opset``` the user can override the default to generate a graph with the desired opset. For example ```--opset 15``` would create a onnx graph that uses only ops available in opset 15. Because older opsets have in most cases fewer ops, some models might not convert on a older opset.
191191

192192
#### --dequantize
193193

tf2onnx/constants.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
MICROSOFT_DOMAIN = "com.microsoft"
1616
CONTRIB_OPS_DOMAIN = "ai.onnx.contrib"
1717

18-
# Default opset version for onnx domain
19-
PREFERRED_OPSET = 9
18+
# Default opset version for onnx domain.
19+
# The current update policy is that the default should be set to
20+
# the latest released version as of 18 months ago.
21+
# Opset 13 was released in ONNX v1.8.0 (Nov, 2020).
22+
PREFERRED_OPSET = 13
2023

2124
# Default opset for custom ops
2225
TENSORFLOW_OPSET = helper.make_opsetid("ai.onnx.converters.tensorflow", 1)

0 commit comments

Comments
 (0)