Skip to content

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

[TF FE] Extend JAX layer tests precommit via TF FE path (#26409)

Roman Kazantsevaeb034becf87
diff --git a/tests/layer_tests/jax_tests/jax_layer_test_class.py b/tests/layer_tests/jax_tests/jax_layer_test_class.py
index 28e53f67e79..64d53bf251a 100644
--- a/tests/layer_tests/jax_tests/jax_layer_test_class.py
+++ b/tests/layer_tests/jax_tests/jax_layer_test_class.py
@@ -2,6 +2,7 @@
# SPDX-License-Identifier: Apache-2.0
import itertools
+import jax
import numpy as np
import os
from common.constants import test_device, test_precision
@@ -120,6 +121,8 @@ class JaxLayerTest:
# create function signature based on input shapes and types
function_signature = []
for _input in inputs:
+ if isinstance(_input, jax.Array):
+ _input = np.array(_input)
assert isinstance(_input, np.ndarray)
input_shape = _input.shape
input_type = _input.dtype
diff --git a/tests/layer_tests/jax_tests/test_add.py b/tests/layer_tests/jax_tests/test_add.py
index 26375256ca2..bddb6e0ebd4 100644
--- a/tests/layer_tests/jax_tests/test_add.py
+++ b/tests/layer_tests/jax_tests/test_add.py
@@ -46,6 +46,7 @@ class TestAdd(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -86,6 +87,7 @@ class TestAddWithConstant(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -126,6 +128,7 @@ class TestAddWithLiteralInvar(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
diff --git a/tests/layer_tests/jax_tests/test_broadcast_in_dim.py b/tests/layer_tests/jax_tests/test_broadcast_in_dim.py
index 08c8e06a3d0..d2b134036fd 100644
--- a/tests/layer_tests/jax_tests/test_broadcast_in_dim.py
+++ b/tests/layer_tests/jax_tests/test_broadcast_in_dim.py
@@ -38,6 +38,7 @@ class TestBroadcastInDim(JaxLayerTest):
@pytest.mark.parametrize("params", test_data_basic)
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_broadcast_in_dim(self, ie_device, precision, ir_version, params):
self._test(*self.create_model(**params),
diff --git a/tests/layer_tests/jax_tests/test_concatenate.py b/tests/layer_tests/jax_tests/test_concatenate.py
index a476a29d9bc..3643bfd8e60 100644
--- a/tests/layer_tests/jax_tests/test_concatenate.py
+++ b/tests/layer_tests/jax_tests/test_concatenate.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -44,6 +43,7 @@ class TestConcatenate(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_concatenate(self, input_shapes, input_type, dimension,
ie_device, precision, ir_version):
diff --git a/tests/layer_tests/jax_tests/test_copy.py b/tests/layer_tests/jax_tests/test_copy.py
index b9623bc333e..8458b47e064 100644
--- a/tests/layer_tests/jax_tests/test_copy.py
+++ b/tests/layer_tests/jax_tests/test_copy.py
@@ -34,6 +34,7 @@ class TestCopy(JaxLayerTest):
[1, 1, 9, 1]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_copy(self, ie_device, precision, ir_version, input_shape):
self._test(*self.create_model(input_shape=input_shape),
diff --git a/tests/layer_tests/jax_tests/test_device_put.py b/tests/layer_tests/jax_tests/test_device_put.py
index 5e01b934d7f..e0afd82af67 100644
--- a/tests/layer_tests/jax_tests/test_device_put.py
+++ b/tests/layer_tests/jax_tests/test_device_put.py
@@ -37,6 +37,7 @@ class TestDevicePut(JaxLayerTest):
@pytest.mark.parametrize("input_shape", [[2], [3, 4]])
@pytest.mark.parametrize("input_type", [np.float32, np.int32])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_device_put(self, ie_device, precision, ir_version, input_shape, input_type):
self._test(*self.create_model(input_shape, input_type),
diff --git a/tests/layer_tests/jax_tests/test_div.py b/tests/layer_tests/jax_tests/test_div.py
index cb9a75efc32..1a0acb6f2d7 100644
--- a/tests/layer_tests/jax_tests/test_div.py
+++ b/tests/layer_tests/jax_tests/test_div.py
@@ -48,6 +48,7 @@ class TestDiv(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -88,6 +89,7 @@ class TestDivWithConstant(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -128,6 +130,7 @@ class TestDivWithLiteralInvar(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
diff --git a/tests/layer_tests/jax_tests/test_exp.py b/tests/layer_tests/jax_tests/test_exp.py
index 2c187774d78..0936375405d 100644
--- a/tests/layer_tests/jax_tests/test_exp.py
+++ b/tests/layer_tests/jax_tests/test_exp.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -38,6 +37,7 @@ class TestExp(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_exp(self, ie_device, precision, ir_version, input_shape, input_type):
self._test(*self.create_model(input_shape, input_type),
diff --git a/tests/layer_tests/jax_tests/test_integer_pow.py b/tests/layer_tests/jax_tests/test_integer_pow.py
index dc83f4fa1dd..802ca16f093 100644
--- a/tests/layer_tests/jax_tests/test_integer_pow.py
+++ b/tests/layer_tests/jax_tests/test_integer_pow.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -38,6 +37,7 @@ class TestIntegerPow(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_integer_pow(self, x_shape, y, input_type,
ie_device, precision, ir_version):
diff --git a/tests/layer_tests/jax_tests/test_mul.py b/tests/layer_tests/jax_tests/test_mul.py
index e13aa1e6ef4..586e8f2adb0 100644
--- a/tests/layer_tests/jax_tests/test_mul.py
+++ b/tests/layer_tests/jax_tests/test_mul.py
@@ -46,6 +46,7 @@ class TestMul(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -86,6 +87,7 @@ class TestMulWithConstant(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -126,6 +128,7 @@ class TestMulWithLiteralInvar(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
diff --git a/tests/layer_tests/jax_tests/test_reduce.py b/tests/layer_tests/jax_tests/test_reduce.py
index b9a097213cb..03ad8345e29 100644
--- a/tests/layer_tests/jax_tests/test_reduce.py
+++ b/tests/layer_tests/jax_tests/test_reduce.py
@@ -1,10 +1,8 @@
# Copyright (C) 2018-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
-import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -44,6 +42,7 @@ class TestReduce(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_reduce(self, input_shape, axis, op_type, input_type,
ie_device, precision, ir_version):
diff --git a/tests/layer_tests/jax_tests/test_reshape.py b/tests/layer_tests/jax_tests/test_reshape.py
index ecefe4f29e1..8f5445b9a65 100644
--- a/tests/layer_tests/jax_tests/test_reshape.py
+++ b/tests/layer_tests/jax_tests/test_reshape.py
@@ -37,6 +37,7 @@ class TestReshape(JaxLayerTest):
[64], [64, 1], [16, 4], [8, 1, 8], [1, 1, 64], [8, 2, 2, 2], [2, 4, 2, 2, 2]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_reshape(self, ie_device, precision, ir_version, input_shape, new_sizes):
self._test(*self.create_model(input_shape=input_shape, new_sizes=new_sizes),
@@ -76,6 +77,7 @@ class TestReshapeWithDimensions(JaxLayerTest):
[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_reshape_with_dimensions(self, ie_device, precision, ir_version, input_shape, new_sizes, dimensions):
self._test(*self.create_model(input_shape=input_shape, new_sizes=new_sizes, dimensions=dimensions),
diff --git a/tests/layer_tests/jax_tests/test_rsqrt.py b/tests/layer_tests/jax_tests/test_rsqrt.py
index 83ca53bcce6..ddbf3e640ce 100644
--- a/tests/layer_tests/jax_tests/test_rsqrt.py
+++ b/tests/layer_tests/jax_tests/test_rsqrt.py
@@ -32,6 +32,7 @@ class TestRsqrt(JaxLayerTest):
[1, 1, 9, 1]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_rsqrt(self, ie_device, precision, ir_version, input_shape):
self._test(*self.create_model(input_shape=input_shape),
diff --git a/tests/layer_tests/jax_tests/test_slice.py b/tests/layer_tests/jax_tests/test_slice.py
index e62d3e5ba91..16cfc114d97 100644
--- a/tests/layer_tests/jax_tests/test_slice.py
+++ b/tests/layer_tests/jax_tests/test_slice.py
@@ -34,6 +34,7 @@ class TestSlice(JaxLayerTest):
[8, 8, 8, 8], [8, 9, 10, 11], [13, 13, 12, 12], [15, 15, 14, 15]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_slice(self, ie_device, precision, ir_version, input_shape, start_indices, limit_indices):
self._test(
@@ -70,6 +71,7 @@ class TestSliceWithStrides(JaxLayerTest):
[1, 1, 1, 1], [1, 2, 3, 4], [10, 15, 12, 3], [8, 5, 4, 1]
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_slice_with_strides(self, ie_device, precision, ir_version, input_shape, start_indices, limit_indices,
strides):
diff --git a/tests/layer_tests/jax_tests/test_sqrt.py b/tests/layer_tests/jax_tests/test_sqrt.py
index a19836c3c87..eaeaa5dff02 100644
--- a/tests/layer_tests/jax_tests/test_sqrt.py
+++ b/tests/layer_tests/jax_tests/test_sqrt.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -36,6 +35,7 @@ class TestSqrt(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_sqrt(self, ie_device, precision, ir_version, input_shape, input_type):
self._test(*self.create_model(input_shape, input_type),
diff --git a/tests/layer_tests/jax_tests/test_squeeze.py b/tests/layer_tests/jax_tests/test_squeeze.py
index f8043c189be..bc461a38e3f 100644
--- a/tests/layer_tests/jax_tests/test_squeeze.py
+++ b/tests/layer_tests/jax_tests/test_squeeze.py
@@ -42,6 +42,7 @@ class TestSqueeze(JaxLayerTest):
@pytest.mark.parametrize("params", test_data_basic)
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_squeeze(self, ie_device, precision, ir_version, params):
self._test(*self.create_model(**params),
diff --git a/tests/layer_tests/jax_tests/test_stop_gradient.py b/tests/layer_tests/jax_tests/test_stop_gradient.py
index b8173f81cd3..91f50000a49 100644
--- a/tests/layer_tests/jax_tests/test_stop_gradient.py
+++ b/tests/layer_tests/jax_tests/test_stop_gradient.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -38,6 +37,7 @@ class TestStopGradient(JaxLayerTest):
@pytest.mark.parametrize("input_shape", [[2], [3, 4]])
@pytest.mark.parametrize("input_type", [np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_jax_stop_gradient(self, ie_device, precision, ir_version, input_shape, input_type):
kwargs = {}
diff --git a/tests/layer_tests/jax_tests/test_sub.py b/tests/layer_tests/jax_tests/test_sub.py
index 0f34b0cfe62..cc7b9521eda 100644
--- a/tests/layer_tests/jax_tests/test_sub.py
+++ b/tests/layer_tests/jax_tests/test_sub.py
@@ -46,6 +46,7 @@ class TestSub(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -86,6 +87,7 @@ class TestSubWithConstant(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
@@ -126,6 +128,7 @@ class TestSubWithLiteralInvar(JaxLayerTest):
]
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
@pytest.mark.parametrize("params", test_data)
@pytest.mark.parametrize("input_type", input_types)
diff --git a/tests/layer_tests/jax_tests/test_tanh.py b/tests/layer_tests/jax_tests/test_tanh.py
index edd82326c07..d0dd8038e9b 100644
--- a/tests/layer_tests/jax_tests/test_tanh.py
+++ b/tests/layer_tests/jax_tests/test_tanh.py
@@ -4,7 +4,6 @@
import jax
import numpy as np
import pytest
-from jax import lax
from jax import numpy as jnp
from jax_layer_test_class import JaxLayerTest
@@ -38,6 +37,7 @@ class TestTanh(JaxLayerTest):
np.int32, np.uint32, np.int64, np.uint64,
np.float16, np.float32, np.float64])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_tanh(self, ie_device, precision, ir_version, input_shape, input_type):
self._test(*self.create_model(input_shape, input_type),
diff --git a/tests/layer_tests/jax_tests/test_transpose.py b/tests/layer_tests/jax_tests/test_transpose.py
index 6e263e508ed..3d3ae70eea2 100644
--- a/tests/layer_tests/jax_tests/test_transpose.py
+++ b/tests/layer_tests/jax_tests/test_transpose.py
@@ -38,6 +38,7 @@ class TestTranspose(JaxLayerTest):
[3, 0, 1, 2], [3, 0, 2, 1], [3, 1, 0, 2], [3, 1, 2, 0], [3, 2, 0, 1], [3, 2, 1, 0],
])
@pytest.mark.nightly
+ @pytest.mark.precommit
@pytest.mark.precommit_jax_fe
def test_transpose(self, ie_device, precision, ir_version, input_shape, permutation):
self._test(*self.create_model(input_shape=input_shape, permutation=permutation),