Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

14.4 KB
Raw Blame
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

import pytest

# test.BACKEND_NAME is a configuration variable determining which
# OV backend tests will use. It's set during pytest configuration time.
# See `pytest_configure` hook in `conftest.py` for more details.
BACKEND_NAME = None

# test.MODEL_ZOO_DIR is a configuration variable providing the path
# to the ZOO of ONNX models to test. It's set during pytest configuration time.
# See `pytest_configure` hook in `conftest.py` for more
# details.
MODEL_ZOO_DIR = None

# test.MODEL_ZOO_XFAIL is a configuration variable which enable xfails for model zoo.
MODEL_ZOO_XFAIL = False


def xfail_test(reason="Mark the test as expected to fail", strict=True):
    return pytest.mark.xfail(reason=reason, strict=strict)

skip_segfault = pytest.mark.skip(reason="Segmentation fault error")
xfail_dynamic_rank = xfail_test(reason="Dynamic rank")
xfail_accuracy = xfail_test(reason="Accuracy")
xfail_issue_69444 = xfail_test(reason="ONNX Resize - AssertionError: Mismatched elements.")
skip_issue_67415 = pytest.mark.skip(reason="RuntimeError: Unsupported data type for when filling blob!")
xfail_issue_67415 = xfail_test(reason="RuntimeError: Unsupported data type for when filling blob!")
xfail_maxunpool_output_shape_onnx_ref = xfail_test(reason="MaxUnpool with output_shape: ONNX reference data places "
                                                          "values in the inferred shape, onnxruntime and OV index "
                                                          "flat(output_shape) (onnx/onnx#2398)")
# GPU: wrong scatter result for a static rank-1 Constant data input
skip_maxunpool_gpu = pytest.mark.skip_on_gpu
skip_issue_38084 = pytest.mark.skip(reason="Aborted (core dumped) Assertion "
                                           "`(layer->get_output_partial_shape(i).is_static())' failed.")
xfail_issue_33596 = xfail_test(reason="RuntimeError: OV does not support different sequence operations: "
                                      "ConcatFromSequence, SequenceConstruct, SequenceAt, SplitToSequence, "
                                      "SequenceEmpty, SequenceInsert, SequenceErase, SequenceLength ")
xfail_issue_33606 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "Det")
xfail_issue_33651 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "TfIdfVectorizer")
xfail_issue_90649 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations:"
                                      "DFT, LayerNormalization, "
                                      "MelWeightMatrix, SequenceMap")
xfail_issue_35923 = xfail_test(reason="RuntimeError: PReLU without weights is not supported")
xfail_issue_38091 = xfail_test(reason="AssertionError: Mismatched elements")
xfail_issue_38699 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "ai.onnx.preview.training.Gradient")
xfail_issue_38701 = xfail_test(reason="RuntimeError: unsupported element type: STRING")
xfail_issue_38706 = xfail_test(reason="RuntimeError: output_3.0 has zero dimension which is not allowed")
xfail_issue_38708 = xfail_test(reason="RuntimeError: While validating ONNX node '<Node(Slice): y>': "
                                      "Axes input must be constant")
xfail_issue_99952 = xfail_test(reason="Col2Im operator is not supported 5 dimensions")
xfail_issue_99955 = xfail_test(reason="GroupNorm is not supported")
xfail_issue_99957 = xfail_test(reason="LayerNorm - RuntimeError: While validating node '<Node(Reshape): Mean>'")
xfail_issue_99960 = xfail_test(reason="MVN - Results mismatch")
xfail_issue_99961 = xfail_test(reason="Optional has/get element operators are not supported)'")
xfail_issue_99962 = pytest.mark.skip(reason="ReduceL1 - Unrecognized attribute: axes for operator ReduceL1")
xfail_issue_99968 = xfail_test(reason="ReduceL1 - Results mismatch or unsupported ReduceSum with "
                                      "dynamic rank by CPU plugin")
xfail_issue_99969 = xfail_test(reason="Resize - Results mismatch / "
                                      "RuntimeError: While validating ONNX node '<Node(Resize): Y>' / "
                                      "RuntimeError: Check '(false)' failed at onnx/frontend/src/op/resize.cpp")
xfail_issue_99970 = xfail_test(reason="Scatter and ScatterND - RuntimeError: Check '(reduction == none)' failed at "
                                      "src/frontends/onnx/frontend/src/op/scatter_elements.cpp OR at "
                                      "src/frontends/onnx/frontend/src/op/scatter_nd")
xfail_issue_38713 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "ai.onnx.preview.training.Momentum")
xfail_issue_38724 = xfail_test(reason="RuntimeError: While validating ONNX node '<Node(Resize): Y>': "
                                      "tf_crop_and_resize - this type of coordinate transformation mode "
                                      "is not supported. Choose one of the following modes: "
                                      "tf_half_pixel_for_nn, asymmetric, align_corners, pytorch_half_pixel, "
                                      "half_pixel")
xfail_issue_38725 = xfail_test(reason="RuntimeError: While validating ONNX node '<Node(Loop): "
                                      "value info has no element type specified")
xfail_issue_38734 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "ai.onnx.preview.training.Adam")
xfail_issue_38735 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "ai.onnx.preview.training.Adagrad")
xfail_issue_48052 = xfail_test(reason="Dropout op is not supported in traning mode")
xfail_issue_44851 = xfail_test(reason="Expected: Unsupported dynamic op: Broadcast")
xfail_issue_44858 = xfail_test(reason="Expected: Unsupported dynamic op: Unsqueeze")
xfail_issue_44957 = xfail_test(reason="Expected: Unsupported dynamic op: NonZero")
xfail_issue_44958 = xfail_test(reason="Expected: Unsupported dynamic op: Interpolate")
xfail_issue_44965 = xfail_test(reason="Expected: RuntimeError: value info has no element")
xfail_issue_47323 = xfail_test(reason="RuntimeError: The plugin does not support FP64")
# Model MSFT issues:
xfail_issue_37957 = xfail_test(reason="RuntimeError: OV does not support the following ONNX operations: "
                                      "com.microsoft.CropAndResize, com.microsoft.GatherND, "
                                      "com.microsoft.Pad, com.microsoft.Range")
xfail_issue_39669 = xfail_test(reason="AssertionError: This model has no test data")
xfail_issue_36534 = xfail_test(reason="RuntimeError: node input index is out of range")
xfail_issue_36536 = xfail_test(reason="RuntimeError: can't protect")
xfail_issue_36538 = xfail_test(reason="RuntimeError: Check 'PartialShape::broadcast_merge_into( pshape, "
                                      "node->get_input_partial_shape(i), autob)' failed at ")
skip_issue_39658 = pytest.mark.skip(reason="RuntimeError: Tile operation has a form that is not supported."
                                           " z should be converted to TileIE operation.")


xfail_issue_37973 = xfail_test(reason="TF Inception V2 - AssertionError: zoo models results mismatch")
xfail_issue_47495 = xfail_test(reason="BertSquad-10 from MSFT - AssertionError: zoo models results mismatch")
xfail_issue_49207 = xfail_test(reason="Model references undeclared parameters")
xfail_issue_48145 = xfail_test(reason="BertSquad-8 - AssertionError: Items are not equal: ACTUAL: 4 "
                                      "DESIRED: 3")
xfail_issue_48190 = xfail_test(reason="RobertaBase-11 - AssertionError: Items are not equal: "
                                      "ACTUAL: dtype('float64') DESIRED: dtype('float32')")
xfail_issue_49752 = xfail_test(reason="RuntimeError: Unsupported dynamic ops: v1::Pad")
xfail_issue_49753 = xfail_test(reason="RuntimeError: Unsupported dynamic ops: v1::StridedSlice")
xfail_issue_49754 = xfail_test(reason="RuntimeError: Unsupported dynamic ops: v1::TopKIE")
xfail_issue_52463 = xfail_test(reason="test_operator_add_size1_singleton_broadcast_cpu - "
                                      "Not equal to tolerance")
xfail_issue_58676 = xfail_test(reason="AssertionError: Not equal to tolerance rtol=0.001, atol=1e-07")
skip_issue_58676 = pytest.mark.skip(reason="AssertionError: Not equal to tolerance rtol=0.001, atol=1e-07")
xfail_issue_onnx_models_140 = xfail_test(reason="https://github.com/onnx/models/issues/140")

skip_rng_tests = pytest.mark.skip(reason="Tests use random number generator with no seed.")
xfail_issue_63137 = xfail_test(reason="Unsupported operations: OptionalHasElement, OptionalGetElement")
xfail_issue_68212 = xfail_test(reason="Unsupported reading model with bytes streams")

xfail_issue_78843 = xfail_test(reason="Missing reference output files for ssd mobilenet models")

xfail_issue_82038 = xfail_test(reason="ScatterElements, ScatterND, AssertionError: Result mismatch")
xfail_issue_82039 = xfail_test(reason="Unsupported data type Optional, RuntimeError: [ NOT_IMPLEMENTED ] "
                                      "CPU plugin: Input image format UNSPECIFIED is not supported yet...")

xfail_issue_86911 = xfail_test(reason="LSTM_Seq_len_unpacked - AssertionError: zoo models results mismatch")
xfail_issue_101965 = xfail_test(reason="Mismatch with numpy-based expected results.")
xfail_issue_113506 = xfail_test(reason="Unsupported operation of type: LSTMSequence Node expects 7 inputs. Actual: 8")

# ONNX 1.14
xfail_issue_119896 = xfail_test(reason="Unsupported element type: FLOAT8", strict=False)
xfail_issue_119900 = xfail_test(reason="While validating ONNX node '<Node(Resize): Y>': "
                                       "half_pixel_symmetric - this type of coordinate transformation mode "
                                       "is not supported. Choose one of the following modes: "
                                       "tf_half_pixel_for_nn, asymmetric, align_corners, pytorch_half_pixel, "
                                       "half_pixel")
xfail_issue_119919 = xfail_test(reason="While validating ONNX node '<Node(Pad): y>': Unsupported padding mode: [wrap]")
xfail_issue_119922 = xfail_test(reason="ai.onnx.ml operators domain isn't supported")
xfail_issue_119925 = xfail_test(reason="AveragePool AssertionError: Not equal to tolerance rtol=0.001, atol=1e-07")
xfail_issue_119926 = xfail_test(reason="ROIAlign AssertionError: Not equal to tolerance rtol=0.001, atol=1e-07")

# ONNX 1.15
xfail_issue_125485 = xfail_test(reason="AffineGrid operation is not supported")
xfail_issue_125488 = xfail_test(reason="ImageDecoder operation is not supported")
skip_issue_125487 = pytest.mark.skip(reason="GridSample doesn't support volumetric (5D) inputs")
skip_issue_124587 = pytest.mark.skip(reason="Fail on new macos machines")
xfail_issue_125492 = xfail_test(reason="DFT mismatch")
xfail_issue_125493 = xfail_test(reason="Reduce* mismatch")
xfail_issue_122776 = xfail_test(reason="test_mish_expanded_cpu - "
                                       "Not equal to tolerance")
xfail_issue_122775 = xfail_test(reason="test_resize_downsample_scales_linear_cpu - "
                                       "Not equal to tolerance")
skip_issue_127649 = pytest.mark.skip(reason="Not equal to tolerance rtol=0.001, atol=1e-07 - "
                                             "Mismatched elements: 1 / 1000 (0.1%)")

# ONNX 1.16
skip_misalignment = pytest.mark.skip(reason="Misalignment between onnx versions") # Need to enable after bumping to 1.16
xfail_issue_139934 = xfail_test(reason = "Int4 isn't supported")
xfail_issue_139936 = xfail_test(reason = "MaxPool accuracy fails")

# ONNX 1.17
skip_issue_119896 = pytest.mark.skip(reason="Unsupported element type: FLOAT8")

# ONNX 1.18
xfail_issue_171767 = pytest.mark.skip(reason="Unsupported element type: FLOAT4E2M1")
xfail_issue_171771 = pytest.mark.skip(reason="Mismatches in tests: Top K values")

# Attention op (ONNX opset 23/24) -- requires ONNX >= 1.23; CI uses ONNX 1.18.
# Tests pass locally when ONNX >= 1.23 is installed.
xfail_attention_onnx_version = pytest.mark.skip(reason="Attention op tests require ONNX >= 1.23; CI uses ONNX 1.18")

# Attention op fully-masked-row / NaN-robustness tests that do not yet pass:
xfail_attention_nan_robustness = pytest.mark.skip(reason="Attention fully-masked-row NaN robustness not yet handled in expanded/SDPA paths")

# ONNX 1.22 (opset 24-27) — operators and data types not yet implemented in the
# OpenVINO ONNX frontend, and reference-data changes exposed by the newer opset.
# These were surfaced when bumping the bundled ONNX submodule to 1.22.0.
xfail_issue_onnx122_linearattention = xfail_test(
    reason="OV ONNX FE does not support LinearAttention-27 (new in ONNX opset 27)")
xfail_issue_onnx122_causalconv = xfail_test(
    reason="OV ONNX FE does not support CausalConvWithState-27 (new in ONNX opset 27)")
xfail_issue_onnx122_flexattention = xfail_test(
    reason="OV ONNX FE does not support ai.onnx.preview.FlexAttention (new preview op in ONNX 1.22)")
xfail_issue_onnx122_bitcast = xfail_test(
    reason="OV ONNX FE does not support BitCast-26 (new in ONNX opset 26)")
xfail_issue_onnx122_cumprod = xfail_test(
    reason="OV ONNX FE does not support CumProd-26 (new in ONNX opset 26)")
xfail_issue_onnx122_attention = xfail_test(
    reason="OV ONNX FE does not fully support Attention-24 for these cases (ONNX opset 24)")
xfail_issue_onnx122_newdtype = xfail_test(
    reason="OV ONNX FE does not support new sub-byte / float8 data types "
           "(INT2/UINT2, INT4/UINT4, FLOAT4E2M1, FLOAT8E8M0, FLOAT8E*FNUZ) in Cast/CastLike/Quantize")
xfail_issue_onnx122_accuracy = xfail_test(
    reason="Accuracy / reference-data mismatch exposed by ONNX 1.22 (e.g. Cast inf-vs-FLT_MAX "
           "saturation, DFT rfft/irfft shape, NonMaxSuppression boundary, Range bfloat16)")
# Plain float-width Cast/CastLike overflow: ONNX 1.22 expects +/-inf while OV core Cast saturates
# to +/-FLT_MAX (infinity handling in OV core). Non-strict so the tests are not required to fail
# and will not XPASS-fail once the core behavior is aligned.
xfail_issue_onnx122_cast_infinity = xfail_test(
    reason="Cast/CastLike float-width overflow: infinity handling in OV core (saturates to FLT_MAX)",
    strict=False)