Skip to content
Merged
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
33 changes: 26 additions & 7 deletions tests/python/frontend/onnx/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -4306,8 +4306,25 @@ def verify_eyelike(indata):
]


targets = [tgt for (tgt, _) in tvm.testing.enabled_targets()]

target_skips = {
"cuda": [
"test_mod_mixed_sign_float16/",
"test_qlinearconv/",
"test_resize_upsample_sizes_nearest/",
]
}


@pytest.mark.parametrize("target", targets)
@pytest.mark.parametrize("test", onnx_test_folders)
def test_onnx_nodes(test):
def test_onnx_nodes(test, target):
if target in target_skips:
for failure in target_skips[target]:
if failure in test:
pytest.skip()
break
for failure in unsupported_onnx_tests:
if failure in test:
pytest.skip()
Expand All @@ -4333,12 +4350,14 @@ def test_onnx_nodes(test):
outputs.append(numpy_helper.to_array(new_tensor))
else:
raise ImportError(str(tensor) + " not labeled as an import or an output")
tvm_val = get_tvm_output_with_vm(onnx_model, inputs, "llvm", tvm.cpu(0))
if len(outputs) == 1:
tvm.testing.assert_allclose(outputs[0], tvm_val, rtol=rtol, atol=atol)
else:
for output, val in zip(outputs, tvm_val):
tvm.testing.assert_allclose(output, val, rtol=rtol, atol=atol)

dev = tvm.device(target, 0)
tvm_val = get_tvm_output_with_vm(onnx_model, inputs, target, dev)
if len(outputs) == 1:
tvm.testing.assert_allclose(outputs[0], tvm_val, rtol=rtol, atol=atol)
else:
for output, val in zip(outputs, tvm_val):
tvm.testing.assert_allclose(output, val, rtol=rtol, atol=atol)


def test_wrong_input():
Expand Down