Skip to content

Commit 20850a6

Browse files
committed
Add ai.onnx.ml opset into the model.opset_imports as a default value.
Signed-off-by: Jay Zhang <[email protected]>
1 parent 872a96b commit 20850a6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

tf2onnx/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# Default opset for custom ops
2222
TENSORFLOW_OPSET = helper.make_opsetid("ai.onnx.converters.tensorflow", 1)
2323

24+
# Built-in supported opset
25+
AI_ONNX_ML_OPSET = helper.make_opsetid(AI_ONNX_ML_DOMAIN, 2)
26+
2427
# Target for the generated onnx graph. It possible targets:
2528
# onnx-1.1 = onnx at v1.1 (winml in rs4 is based on this)
2629
# caffe2 = include some workarounds for caffe2 and winml

tf2onnx/graph.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,8 @@ def make_model(self, graph_doc, optimize=False, graph_name="tf2onnx", external_t
11931193
"producer_version": __version__}
11941194

11951195
if "opset_imports" not in kwargs:
1196-
opsets = []
1197-
imp = OperatorSetIdProto()
1198-
imp.version = self._opset
1199-
opsets.append(imp)
1196+
opsets = [helper.make_opsetid(constants.ONNX_DOMAIN, self._opset)]
1197+
opsets.append(constants.AI_ONNX_ML_OPSET)
12001198
if self.extra_opset is not None:
12011199
opsets.extend(self.extra_opset)
12021200
kwargs["opset_imports"] = opsets

0 commit comments

Comments
 (0)