Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion tests/backend_test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import numpy as np
import tensorflow as tf
from tensorflow.python.ops import variables as variables_lib
import onnx
from common import get_test_config
from tf2onnx import utils
from tf2onnx.tfonnx import process_tf_graph
Expand Down Expand Up @@ -63,12 +64,21 @@ def run_onnxcaffe2(self, onnx_graph, inputs):
def run_onnxruntime(self, model_path, inputs, output_names):
"""Run test against onnxruntime backend."""
import onnxruntime as rt
try:
from onnxruntime.capi.onnxruntime_pybind11_state import Fail
except ImportError:
Fail = RuntimeError
opt = rt.SessionOptions()
# in case of issues with the runtime, one can enable more logging
# opt.log_severity_level = 0
# opt.log_verbosity_level = 255
# opt.enable_profiling = True
m = rt.InferenceSession(model_path, opt)
try:
m = rt.InferenceSession(model_path, opt)
except Fail as e:
with open(model_path, 'rb') as f:
onx = onnx.load(f)
raise AssertionError("Unable to load model '{}'\n{}".format(model_path, onx)) from e
results = m.run(output_names, inputs)
return results

Expand Down
1 change: 0 additions & 1 deletion tests/test_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,6 @@ def test_duplicated_duplicated_attributes(self):
op_type="ReduceSum", remaining_op_num=2)

def _check_initializer_num(self, graph_proto, num):
print(len(graph_proto.initializer))
return num == len(graph_proto.initializer)

def test_duplicated_duplicated_constant(self):
Expand Down
2 changes: 1 addition & 1 deletion tf2onnx/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
MICROSOFT_DOMAIN = "com.microsoft"

# Default opset version for onnx domain
PREFERRED_OPSET = 8
PREFERRED_OPSET = 11

# Default opset for custom ops
TENSORFLOW_OPSET = helper.make_opsetid("ai.onnx.converters.tensorflow", 1)
Expand Down
4 changes: 2 additions & 2 deletions tf2onnx/custom_opsets/ms.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def version_1(cls, ctx, node, **kwargs):
# set node's attrs, Note: output_padding, group are left default.
conv_dims_attr(node, "dilations")
# set node's inputs from (output_shape, filter, input_tensor) to (input_tensor, filter, pads, Bias)
node.input[0] = node.input[2]
node.input[2] = pads.output[0]
ctx.replace_input(node, node.input[0], node.input[2], 0)
ctx.replace_input(node, node.input[2], pads.output[0], 2)
conv_convert_inputs(ctx, node, with_kernel=True)
node.attr.pop("data_format")
node.attr.pop("padding")
Expand Down
Loading