[PT FE] Run GPU with FP32 hint when layer test is FP32 (#23511)
### Details: - *Run GPU with FP32 hint when layer test is FP32* - *Xfail tests unsupported on GPU* ### Tickets: - *ticket-id*
This commit is contained in:
parent
f1dcc4c310
commit
224acd355a
|
|
@ -12,6 +12,7 @@ from openvino.frontend.pytorch.ts_decoder import TorchScriptPythonDecoder
|
|||
|
||||
from openvino.frontend import FrontEndManager
|
||||
from openvino.runtime import Core, Type, PartialShape
|
||||
import openvino.properties.hint as hints
|
||||
import torch
|
||||
from packaging import version
|
||||
import openvino.torch
|
||||
|
|
@ -123,7 +124,10 @@ class PytorchLayerTest:
|
|||
smodel.inlined_graph, op), f"Operation {op} type doesn't exist in provided graph"
|
||||
# OV infer:
|
||||
core = Core()
|
||||
compiled = core.compile_model(converted_model, ie_device)
|
||||
config = {}
|
||||
if ie_device == "GPU" and precision == "FP32":
|
||||
config[hints.inference_precision] = Type.f32
|
||||
compiled = core.compile_model(converted_model, ie_device, config)
|
||||
infer_res = compiled(deepcopy(ov_inputs))
|
||||
|
||||
if hasattr(self, 'skip_framework') and self.skip_framework:
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ class TestAdaptiveAvgPool3D(PytorchLayerTest):
|
|||
@pytest.mark.precommit_torch_export
|
||||
@pytest.mark.precommit_fx_backend
|
||||
def test_adaptive_avg_pool3d(self, ie_device, precision, ir_version, input_tensor, output_size):
|
||||
if ie_device == "GPU" and len(input_tensor) < 5:
|
||||
pytest.xfail(reason="Unsupported shape for adaptive pool on GPU")
|
||||
self.input_tensor = np.random.randn(*input_tensor).astype(np.float32)
|
||||
self._test(*self.create_model(output_size), ie_device, precision, ir_version)
|
||||
|
||||
|
|
@ -96,5 +98,3 @@ class TestAdaptiveAvgPool1D(PytorchLayerTest):
|
|||
def test_adaptive_avg_pool1d(self, ie_device, precision, ir_version, input_shape, output_size):
|
||||
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
|
||||
self._test(*self.create_model(output_size), ie_device, precision, ir_version)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ class TestAdaptiveMaxPool3D(PytorchLayerTest):
|
|||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
||||
reason='Ticket - 122715')
|
||||
def test_adaptive_max_pool3d(self, ie_device, precision, ir_version, input_shape, output_size, return_indices):
|
||||
if ie_device == "GPU" and len(input_shape) < 5:
|
||||
pytest.xfail(reason="Unsupported shape for adaptive pool on GPU")
|
||||
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
|
||||
self._test(*self.create_model(output_size, return_indices), ie_device, precision, ir_version)
|
||||
|
||||
|
|
|
|||
|
|
@ -69,13 +69,17 @@ class TestAnd(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_and_int(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array(3, dtype=np.int32), np.array(4, dtype=np.int32))
|
||||
self._test(*self.create_model_int_input(), ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_and_tensor(self, ie_device, precision, ir_version):
|
||||
def test_and_int_tensor(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array([3, 5, 8], dtype=np.int32), np.array([7, 11, 2], dtype=np.int32))
|
||||
self._test(
|
||||
*self.create_model_tensor_input(), ie_device, precision, ir_version, freeze_model=False, trace_model=True
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ class TestBitwiseOp(PytorchLayerTest):
|
|||
def test_bitwise_mixed_dtypes(
|
||||
self, op_type, out, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape, ie_device, precision, ir_version
|
||||
):
|
||||
if ie_device == "GPU" and (lhs_dtype != "bool" or rhs_dtype != "bool"):
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self._test(
|
||||
*self.create_model(op_type, out),
|
||||
ie_device,
|
||||
|
|
@ -120,6 +122,8 @@ class TestBitwiseOperators(PytorchLayerTest):
|
|||
],
|
||||
)
|
||||
def test_bitwise_operators(self, lhs_dtype, rhs_dtype, lhs_shape, rhs_shape, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and (lhs_dtype != "bool" or rhs_dtype != "bool"):
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self._test(
|
||||
*self.create_model(),
|
||||
ie_device,
|
||||
|
|
|
|||
|
|
@ -210,6 +210,8 @@ class TestConvolution(PytorchLayerTest):
|
|||
@pytest.mark.precommit_fx_backend
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_convolution1d(self, params, bias, underscore, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and params["dilations"] != [1]:
|
||||
pytest.xfail(reason="Unsupported dilations of Convolution on GPU")
|
||||
self._test(*self.create_model(**params, bias=bias, underscore=underscore),
|
||||
ie_device, precision, ir_version, dynamic_shapes=params['groups'] == 1,
|
||||
kwargs_to_prepare_input={'ndim': 3})
|
||||
|
|
@ -222,6 +224,8 @@ class TestConvolution(PytorchLayerTest):
|
|||
@pytest.mark.precommit_fx_backend
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_convolution2d(self, params, bias, underscore, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and params["dilations"] != [1, 1]:
|
||||
pytest.xfail(reason="Unsupported dilations of Convolution on GPU")
|
||||
self._test(*self.create_model(**params, bias=bias, underscore=underscore),
|
||||
ie_device, precision, ir_version, dynamic_shapes=params['groups'] == 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ class TestLinalgCross(PytorchLayerTest):
|
|||
|
||||
def forward(self, x, y):
|
||||
return torch.linalg.cross(x, y, dim=self.dim)
|
||||
|
||||
|
||||
def forward_out(self, x, y, out):
|
||||
return torch.linalg.cross(x, y, dim=self.dim, out=out), out
|
||||
|
||||
|
||||
def forward_no_dim_out(self, x, y, out):
|
||||
return torch.linalg.cross(x, y, out=out), out
|
||||
|
||||
|
|
@ -54,13 +54,17 @@ class TestLinalgCross(PytorchLayerTest):
|
|||
((4, 3), (1, 3), 1),
|
||||
((3, 5), (3, 5), 0),
|
||||
((2, 3, 4), (2, 3, 4), 1)
|
||||
])
|
||||
])
|
||||
@pytest.mark.parametrize('dtype', ['float32', 'float64'])
|
||||
@pytest.mark.parametrize("out", [True, False])
|
||||
def test_linalg_cross(self, x_shape, y_shape, dim, out, dtype, ie_device, precision, ir_version):
|
||||
self._test(
|
||||
*self.create_model(dim, out), ie_device, precision, ir_version, use_convert_model=True,
|
||||
kwargs_to_prepare_input={"x_shape":x_shape, "y_shape": y_shape, "out": out, 'dtype': dtype})
|
||||
*self.create_model(dim, out), ie_device, precision, ir_version, use_convert_model=True,
|
||||
kwargs_to_prepare_input={"x_shape": x_shape,
|
||||
"y_shape": y_shape,
|
||||
"out": out,
|
||||
'dtype': dtype},
|
||||
dynamic_shapes=ie_device != "GPU")
|
||||
|
||||
|
||||
class TestCross(PytorchLayerTest):
|
||||
|
|
@ -87,10 +91,10 @@ class TestCross(PytorchLayerTest):
|
|||
|
||||
def forward(self, x, y):
|
||||
return torch.cross(x, y, dim=self.dim)
|
||||
|
||||
|
||||
def forward_out(self, x, y, out):
|
||||
return torch.cross(x, y, dim=self.dim, out=out), out
|
||||
|
||||
|
||||
def forward_no_dim_out(self, x, y, out):
|
||||
x = torch.reshape(x, self.shape)
|
||||
return torch.cross(x, y, out=out), out
|
||||
|
|
@ -113,10 +117,14 @@ class TestCross(PytorchLayerTest):
|
|||
((3, 1), (3, 4), None),
|
||||
((4, 3), (4, 3), None),
|
||||
((2, 3, 4), (2, 3, 4), None),
|
||||
])
|
||||
])
|
||||
@pytest.mark.parametrize("out", [True, False])
|
||||
@pytest.mark.parametrize('dtype', ['float32', 'float64'])
|
||||
def test_linalg_cross(self, x_shape, y_shape, dim, out, dtype, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(dim, out, x_shape), ie_device, precision, ir_version,
|
||||
use_convert_model=True,
|
||||
kwargs_to_prepare_input={"x_shape":x_shape, "y_shape": y_shape, "out": out, "dtype": dtype})
|
||||
self._test(*self.create_model(dim, out, x_shape), ie_device, precision, ir_version,
|
||||
use_convert_model=True,
|
||||
kwargs_to_prepare_input={"x_shape": x_shape,
|
||||
"y_shape": y_shape,
|
||||
"out": out,
|
||||
"dtype": dtype},
|
||||
dynamic_shapes=ie_device != "GPU")
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ class TestCumSum(PytorchLayerTest):
|
|||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
||||
reason='Ticket - 122715')
|
||||
def test_cumsum(self, axis, dtype, out, dtype_from_input, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and dtype == "int8":
|
||||
pytest.xfail(reason="Cumsum for i8 is unsupported on GPU")
|
||||
if out and PytorchLayerTest.use_torch_export():
|
||||
pytest.skip(reason="export fails for out")
|
||||
self._test(*self.create_model(axis, dtype, out, dtype_from_input), ie_device, precision, ir_version, kwargs_to_prepare_input={"out": out, "out_dtype": dtype})
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ class TestDeformableConvolution(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
@pytest.mark.precommit_fx_backend
|
||||
def test_deformable_convolution2d(self, params, bias, mask, ie_device, precision, ir_version):
|
||||
self._test(
|
||||
*self.create_model(**params, bias=bias, mask=mask), ie_device, precision, ir_version, trace_model=True
|
||||
)
|
||||
self._test(*self.create_model(**params, bias=bias, mask=mask),
|
||||
ie_device, precision, ir_version, trace_model=True,
|
||||
dynamic_shapes=ie_device != "GPU"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -100,4 +100,4 @@ class TestEinsumTranspose(PytorchLayerTest):
|
|||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_einsum_transpose(self, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version)
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version)
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ class TestEmbedding(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("indicies_dtype", ["int", "int32"])
|
||||
def test_embedding(self, ie_device, precision, ir_version, indicies_size, indicies_dtype):
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"indicies_size": indicies_size, "indicies_dtype": indicies_dtype})
|
||||
kwargs_to_prepare_input={"indicies_size": indicies_size, "indicies_dtype": indicies_dtype})
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class TestEmbeddingBag1dOffsets(PytorchLayerTest):
|
|||
def test_embedding_bag(self, ie_device, precision, ir_version, indicies_dtype, per_sample_weights):
|
||||
self._test(*self.create_model(per_sample_weights), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"indicies_dtype": indicies_dtype, "per_sample_weights": per_sample_weights},
|
||||
trace_model=True, dynamic_shapes=not per_sample_weights)
|
||||
trace_model=True, dynamic_shapes=not per_sample_weights and ie_device != "GPU")
|
||||
|
||||
|
||||
class TestEmbeddingBag2d(PytorchLayerTest):
|
||||
|
|
@ -96,4 +96,4 @@ class TestEmbeddingBag2d(PytorchLayerTest):
|
|||
def test_embedding_bag(self, ie_device, precision, ir_version, indicies_dtype, indicies_size, per_sample_weights):
|
||||
self._test(*self.create_model(per_sample_weights), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"indicies_size": indicies_size, "indicies_dtype": indicies_dtype, "per_sample_weights": per_sample_weights},
|
||||
trace_model=True, dynamic_shapes=not per_sample_weights)
|
||||
trace_model=True, dynamic_shapes=not per_sample_weights and ie_device != "GPU")
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ class TestEye(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("dtype", ["bool", "int8", "uint8", "int32", "int64", "float32", "float64"])
|
||||
@pytest.mark.parametrize("m", [2, 3, 4, 5])
|
||||
def test_eye_square(self, dtype, m, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="eye is not supported on GPU")
|
||||
self._test(*self.create_model(1, dtype), ie_device, precision, ir_version, kwargs_to_prepare_input={"m": m})
|
||||
|
||||
@pytest.mark.nightly
|
||||
|
|
@ -61,4 +63,6 @@ class TestEye(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("dtype", ["bool", "int8", "uint8", "int32", "int64", "float32", "float64"])
|
||||
@pytest.mark.parametrize(("m", "n"), [[2, 2], [3, 4], [5, 3]])
|
||||
def test_eye(self, dtype, m, n, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(2, dtype), ie_device, precision, ir_version, kwargs_to_prepare_input={"m": m, "n": n})
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="eye is not supported on GPU")
|
||||
self._test(*self.create_model(2, dtype), ie_device, precision, ir_version, kwargs_to_prepare_input={"m": m, "n": n})
|
||||
|
|
|
|||
|
|
@ -41,4 +41,4 @@ class TestFlip(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("out", [skip_if_export(True), False])
|
||||
@pytest.mark.parametrize("dtype", ["float32", "float64", "int32", "int64", "uint8"])
|
||||
def test_flip(self, axis, out, dtype, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(axis, out), ie_device, precision, ir_version, kwargs_to_prepare_input={"out": out, "dtype": dtype})
|
||||
self._test(*self.create_model(axis, out), ie_device, precision, ir_version, kwargs_to_prepare_input={"out": out, "dtype": dtype})
|
||||
|
|
|
|||
|
|
@ -195,6 +195,8 @@ class TestFillDiagonal(PytorchLayerTest):
|
|||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() == 'arm64',
|
||||
reason='Ticket - 122715')
|
||||
def test_fill_diagonal(self, shape, value, input_dtype, value_dtype, wrap, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="fill_diagonal is not supported on GPU")
|
||||
self._test(*self.create_model(shape, wrap), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={
|
||||
'value': value,
|
||||
|
|
|
|||
|
|
@ -47,4 +47,4 @@ class TestGelu(PytorchLayerTest):
|
|||
def test_gather(self, m, n, axis, out, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(axis, out), ie_device, precision, ir_version, kwargs_to_prepare_input={
|
||||
"m": m, "n": n, "max_val": m if axis == 0 else n, "out": out
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ class TestGelu(PytorchLayerTest):
|
|||
@pytest.mark.precommit_torch_export
|
||||
@pytest.mark.parametrize("approximate", ["none", "tanh"])
|
||||
def test_glu(self, approximate, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(approximate), ie_device, precision, ir_version)
|
||||
self._test(*self.create_model(approximate), ie_device, precision, ir_version)
|
||||
|
|
|
|||
|
|
@ -33,4 +33,4 @@ class TestHardSigmoid(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("dtype", ["float32", "float64"])
|
||||
@pytest.mark.parametrize("inplace", [skip_if_export(True), False])
|
||||
def test_hardsigmoid(self, shape, dtype, inplace, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(inplace), ie_device, precision, ir_version, kwargs_to_prepare_input={"shape": shape, "dtype": dtype})
|
||||
self._test(*self.create_model(inplace), ie_device, precision, ir_version, kwargs_to_prepare_input={"shape": shape, "dtype": dtype})
|
||||
|
|
|
|||
|
|
@ -237,4 +237,3 @@ class TestMaskKosmos_IndexPut(PytorchLayerTest):
|
|||
def test_nonzero_kosmos_index_put_(self, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(), ie_device, precision,
|
||||
ir_version, trace_model=True, use_convert_model=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ class TestInverse(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
def test_inverse(self, data, dtype, out, ie_device, precision, ir_version):
|
||||
self.input_tensor = np.array(data, dtype=dtype)
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="Inverse-14 is not supported on GPU")
|
||||
if not out:
|
||||
self._test(aten_inverse(), None, "aten::linalg_inv",
|
||||
ie_device, precision, ir_version, trace_model=True, freeze_model=False)
|
||||
|
|
@ -105,4 +107,3 @@ class TestInverse(PytorchLayerTest):
|
|||
else:
|
||||
self._test(aten_inverse_out(), None, "aten::linalg_inv",
|
||||
ie_device, precision, ir_version, trace_model=True, freeze_model=False, kwargs_to_prepare_input={"out": out})
|
||||
|
||||
|
|
|
|||
|
|
@ -81,4 +81,4 @@ class TestMaskedScatter(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("mask_dtype", ["uint8"])
|
||||
def test_masked_scatter_inplace_u8(self, shape, input_dtype, mask_dtype, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(inplace=True), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"shape": shape, "x_dtype": input_dtype, "mask_dtype": mask_dtype})
|
||||
kwargs_to_prepare_input={"shape": shape, "x_dtype": input_dtype, "mask_dtype": mask_dtype})
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ class TestMinMax(PytorchLayerTest):
|
|||
@pytest.mark.precommit_torch_export
|
||||
@pytest.mark.precommit_fx_backend
|
||||
def test_min_max(self, op_type, first_input_dtype, second_input_dtype, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and first_input_dtype == "uint8" and second_input_dtype == "uint8":
|
||||
pytest.xfail(reason="Cumsum for i8 is unsupported on GPU")
|
||||
self._test(*self.create_model(op_type, None, None, single_input=False, dtypes=(first_input_dtype, second_input_dtype)),
|
||||
ie_device, precision, ir_version, kwargs_to_prepare_input=
|
||||
{"second_input": True, "input_dtype": first_input_dtype, "second_input_dtype": second_input_dtype}
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ class TestMultinomial(PytorchLayerTest):
|
|||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_multinomial(self, input, num_samples, replacement, out, test_type, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="multinomial with num_samples is unsupported on GPU")
|
||||
self._test(
|
||||
*self.create_model(replacement, out, test_type),
|
||||
ie_device,
|
||||
|
|
|
|||
|
|
@ -10,36 +10,30 @@ from pytorch_layer_test_class import PytorchLayerTest
|
|||
|
||||
class TestNarrow(PytorchLayerTest):
|
||||
def _prepare_input(self):
|
||||
return (self.input_tensor, self.dim, self.start, self.length)
|
||||
return (np.random.randn(*self.input_shape).astype(np.float32),)
|
||||
|
||||
def create_model(self):
|
||||
def create_model(self, dim, start, length):
|
||||
|
||||
class aten_narrow(torch.nn.Module):
|
||||
def __init__(self, dim, start, length):
|
||||
super().__init__()
|
||||
self.dim = dim
|
||||
self.start = start
|
||||
self.length = length
|
||||
|
||||
def forward(self, input_tensor, dim: int, start, length: int):
|
||||
return torch.narrow(input_tensor, dim=dim, start=start, length=length)
|
||||
def forward(self, input_tensor):
|
||||
return torch.narrow(input_tensor, dim=self.dim, start=self.start, length=self.length)
|
||||
|
||||
ref_net = None
|
||||
|
||||
return aten_narrow(), ref_net, "aten::narrow"
|
||||
return aten_narrow(dim, start, length), None, "aten::narrow"
|
||||
|
||||
@pytest.mark.parametrize("input_shape", [
|
||||
[3, 3], [3, 4, 5]
|
||||
])
|
||||
@pytest.mark.parametrize("dim", [
|
||||
np.array(0).astype(np.int32), np.array(1).astype(np.int32), np.array(-1).astype(np.int32)
|
||||
])
|
||||
@pytest.mark.parametrize("start", [
|
||||
np.array(0).astype(np.int32), np.array(1).astype(np.int32)
|
||||
])
|
||||
@pytest.mark.parametrize("length", [
|
||||
np.array(1).astype(np.int32), np.array(2).astype(np.int32)
|
||||
])
|
||||
@pytest.mark.parametrize("dim", [0, 1, -1])
|
||||
@pytest.mark.parametrize("start", [0, 1])
|
||||
@pytest.mark.parametrize("length", [1, 2])
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_narrow(self, input_shape, dim, start, length, ie_device, precision, ir_version):
|
||||
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
|
||||
self.dim = dim
|
||||
self.start = start
|
||||
self.length = length
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version)
|
||||
self.input_shape = input_shape
|
||||
self._test(*self.create_model(dim, start, length), ie_device, precision, ir_version)
|
||||
|
|
|
|||
|
|
@ -66,12 +66,16 @@ class TestOr(PytorchLayerTest):
|
|||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_or_int(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array(3, dtype=np.int32), np.array(4, dtype=np.int32))
|
||||
self._test(*self.create_model_int_input(), ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_or_tensor(self, ie_device, precision, ir_version):
|
||||
def test_or_int_tensor(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array([3, 5, 8], dtype=np.int32), np.array([7, 11, 2], dtype=np.int32))
|
||||
self._test(
|
||||
*self.create_model_tensor_input(), ie_device, precision, ir_version, freeze_model=False, trace_model=True
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@ class TestOuter(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
def test_numel(self, x_shape, y_shape, x_dtype, y_dtype, out, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(out, x_dtype, y_dtype), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"out": out, "x_shape": x_shape, "y_shape": y_shape, "x_dtype": x_dtype, "y_dtype": y_dtype})
|
||||
kwargs_to_prepare_input={"out": out, "x_shape": x_shape, "y_shape": y_shape, "x_dtype": x_dtype, "y_dtype": y_dtype})
|
||||
|
|
|
|||
|
|
@ -56,4 +56,5 @@ class TestPermuteList(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_permute(self, order, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version, kwargs_to_prepare_input={"permute_shape": order})
|
||||
self._test(*self.create_model(), ie_device, precision, ir_version,
|
||||
kwargs_to_prepare_input={"permute_shape": order}, dynamic_shapes=ie_device != "GPU")
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ class TestPowMixedTypes(PytorchLayerTest):
|
|||
self.lhs_shape = lhs_shape
|
||||
self.rhs_type = rhs_type
|
||||
self.rhs_shape = rhs_shape
|
||||
if ie_device == "GPU" and rhs_type not in [torch.float32, torch.float64] and lhs_type not in [torch.float32, torch.float64]:
|
||||
pytest.xfail(reason="pow is not supported on GPU for integer types")
|
||||
self._test(*self.create_model(lhs_type, lhs_shape, rhs_type, rhs_shape),
|
||||
ie_device, precision, ir_version)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,4 +40,5 @@ class TestRoll(PytorchLayerTest):
|
|||
@pytest.mark.precommit_torch_export
|
||||
@pytest.mark.precommit_fx_backend
|
||||
def test_roll(self, shifts, dim, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(shifts, dim), ie_device, precision, ir_version)
|
||||
self._test(*self.create_model(shifts, dim), ie_device, precision, ir_version,
|
||||
dynamic_shapes=ie_device != "GPU")
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ class TestRound(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("out", [True, False])
|
||||
@pytest.mark.parametrize("dtype", ["float32", "float64", "int32", "int64"])
|
||||
def test_round(self, out, dtype, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and dtype not in ["float32", "float64"]:
|
||||
pytest.xfail(reason="square is not supported on GPU for integer types")
|
||||
self._test(*self.create_model(out), ie_device, precision, ir_version, kwargs_to_prepare_input={"out": out, "dtype": dtype})
|
||||
|
||||
|
||||
|
|
@ -82,7 +84,9 @@ class TestRoundScalar(PytorchLayerTest):
|
|||
@pytest.mark.parametrize("input_type", ["int", "float"])
|
||||
def test_round(self, input_type, ie_device, precision, ir_version):
|
||||
if input_type == "int":
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="round is not supported on GPU for integer types")
|
||||
self._prepare_input = self._prepare_input_int
|
||||
else:
|
||||
self._prepare_input = self._prepare_input_float
|
||||
self._test(*self.create_model(input_type), ie_device, precision, ir_version, trace_model=True)
|
||||
self._test(*self.create_model(input_type), ie_device, precision, ir_version, trace_model=True)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class TestSetItem(PytorchLayerTest):
|
|||
|
||||
return aten_set_item(idx), ref_net, "aten::_set_item"
|
||||
|
||||
@pytest.mark.parametrize("idx", [0, 1, pytest.param(-1, marks=pytest.mark.xfail(reason="103748 ov scatter do not support negative indices"))])
|
||||
@pytest.mark.parametrize("idx", [0, 1, -1])
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
@pytest.mark.xfail(condition=platform.system() == 'Darwin' and platform.machine() in ('x64', 'x86_64'),
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ class TestSquareTypes(PytorchLayerTest):
|
|||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_square_types(self, ie_device, precision, ir_version, type, shape):
|
||||
if ie_device == "GPU" and type != torch.float32:
|
||||
pytest.xfail(reason="square is not supported on GPU for integer types")
|
||||
self.type = type
|
||||
self.shape = shape
|
||||
self._test(*self.create_model(type),
|
||||
|
|
|
|||
|
|
@ -53,4 +53,4 @@ class TestTakeAlongDim(PytorchLayerTest):
|
|||
def test_gather(self, m, n, axis, out, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(axis, out), ie_device, precision, ir_version, kwargs_to_prepare_input={
|
||||
"m": m, "n": n, "max_val": m if axis == 0 else n, "out": out, "flattenize": axis is None
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -68,4 +68,4 @@ class TestUnflattenListSizes(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
@pytest.mark.precommit_torch_export
|
||||
def test_unflatten(self, dim, dtype, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(dim), ie_device, precision, ir_version, kwargs_to_prepare_input={"dtype": dtype})
|
||||
self._test(*self.create_model(dim), ie_device, precision, ir_version, kwargs_to_prepare_input={"dtype": dtype})
|
||||
|
|
|
|||
|
|
@ -42,5 +42,8 @@ class TestUnfold(PytorchLayerTest):
|
|||
@pytest.mark.precommit_fx_backend
|
||||
def test_unfold(self, ie_device, precision, ir_version, dimension, size, step, input_shape):
|
||||
self.input_tensor = np.random.randn(*input_shape).astype(np.float32)
|
||||
dyn_shape = True
|
||||
if ie_device == "GPU" and size == 1 and step == 1:
|
||||
dyn_shape = False
|
||||
self._test(*self.create_model(dimension, size, step),
|
||||
ie_device, precision, ir_version)
|
||||
ie_device, precision, ir_version, dynamic_shapes=dyn_shape)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class TestUpsample1D(PytorchLayerTest):
|
|||
@pytest.mark.precommit
|
||||
@pytest.mark.skipif(platform == 'darwin', reason="Ticket - 122182")
|
||||
def test_upsample1d(self, mode, size, scale, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU" and mode == "linear":
|
||||
pytest.xfail(reason="1D linear upsample is unsupported on GPU")
|
||||
self._test(*self.create_model(size, scale, mode), ie_device,
|
||||
precision, ir_version, trace_model=True)
|
||||
|
||||
|
|
|
|||
|
|
@ -66,12 +66,16 @@ class TestXor(PytorchLayerTest):
|
|||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_xor_int(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array(3, dtype=np.int32), np.array(4, dtype=np.int32))
|
||||
self._test(*self.create_model_int_input(), ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_xor_tensor(self, ie_device, precision, ir_version):
|
||||
def test_xor_int_tensor(self, ie_device, precision, ir_version):
|
||||
if ie_device == "GPU":
|
||||
pytest.xfail(reason="bitwise ops are not supported on GPU")
|
||||
self.input_data = (np.array([3, 5, 8], dtype=np.int32), np.array([7, 11, 2], dtype=np.int32))
|
||||
self._test(
|
||||
*self.create_model_tensor_input(), ie_device, precision, ir_version, freeze_model=False, trace_model=True
|
||||
|
|
|
|||
Loading…
Reference in New Issue