repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
openvino
tests/layer_tests/pytorch_tests/test_isinf.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', (np.array([float("inf"), float("nan"), -float("inf"), 0.0, 1.0, -1.0...
33
997
openvino
tests/layer_tests/pytorch_tests/pytorch_layer_test_class.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import itertools import warnings from copy import deepcopy import os import torch import pytest import logging import numpy as np from common.constants import test_device, test_precision from openvino.frontend.pytorch.ts_decoder import ...
616
25,743
openvino
tests/layer_tests/pytorch_tests/test_fp16.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestBF16(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(10),) def create_model(self): class aten_...
58
1,828
openvino
tests/layer_tests/pytorch_tests/test_cond.py
.py
# Copyright (C) 2018-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from pytorch_layer_test_class import PytorchLayerTest class TestCondFX(PytorchLayerTest): """Test torch.cond operation for FX export mode.""" def _prepare_input(self): return (self.rand...
95
3,489
openvino
tests/layer_tests/pytorch_tests/test_repeat_interleave.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest import numpy as np import random import torch @pytest.mark.parametrize('input_data', ({'repeats': 1, 'dim': 0}, {'repeats': 2, ...
134
5,841
openvino
tests/layer_tests/pytorch_tests/test_pad.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPad(PytorchLayerTest): def _prepare_input(self, ndim=4, dtype="float32"): import numpy as np input_5d_shape = [1, 3, 14, 14, 18] ...
244
10,548
openvino
tests/layer_tests/pytorch_tests/test_is_nonzero.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', (np.array([0.]), np.array([1.5]), np.array([False]), np.array([3]))) class TestIsNonZero(Pyto...
32
935
openvino
tests/layer_tests/pytorch_tests/test_linspace.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestLinspace(PytorchLayerTest): def _prepare_input(self, start, end, steps, dtype=None, ref_dtype=None): ...
95
3,763
openvino
tests/layer_tests/pytorch_tests/test_type_as.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestTypeAs(PytorchLayerTest): def _prepare_input(self, input_dtype=np.float32, cast_dtype=np.float32): input_data = self.random.r...
65
2,535
openvino
tests/layer_tests/pytorch_tests/test_cross.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 # Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # torch.cross without the dim argument is...
138
5,320
openvino
tests/layer_tests/pytorch_tests/test_quantize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch import torch.ao.quantization.fx._decomposed from pytorch_layer_test_class import PytorchLayerTest class aten_quantize_per_tensor_aten_dequantize(torch.nn.Module): def ...
223
9,273
openvino
tests/layer_tests/pytorch_tests/test_tensor_split.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from collections.abc import Collection from numbers import Number import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestTensorSplit(PytorchLayerTest): def _prepare_input(self): return (...
67
2,223
openvino
tests/layer_tests/pytorch_tests/test_isfinite.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', (np.array([2, 0, 1, -2]),)) class TestIsFinite(PytorchLayerTest): def _prepare_input(sel...
31
926
openvino
tests/layer_tests/pytorch_tests/test_rsub.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestRsub(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model(self, second_type...
112
3,804
openvino
tests/layer_tests/pytorch_tests/test_adaptive_avg_pool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_tensor', [[1, 2, 8, 9, 10], [2, 8, 9, 10]]) @pytest.mark.parametrize('output_size', [[5, 7, 9], 7]) class TestAdaptiveAvg...
97
3,528
openvino
tests/layer_tests/pytorch_tests/test_scaled_dot_product_attention.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestScaledDotProductAttention(PytorchLayerTest): def _prepare_input(self, dtype): return (self.random.randn(1, 2, 8, 4, dtype=dty...
142
7,216
openvino
tests/layer_tests/pytorch_tests/test_atan2.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize("input_shape_rhs", [ [2, 5, 3, 4], [1, 5, 3, 4], [1] ]) class TestAtan2(PytorchLayerTest): def _prepare_input(se...
145
5,695
openvino
tests/layer_tests/pytorch_tests/test_convnd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from openvino.frontend import FrontEndManager from openvino.frontend.pytorch.ts_decoder import TorchScriptPythonDecoder from pytorch_layer_test_class import PytorchLayerTest class TestConv2D(PytorchLayerTest): def _pr...
221
10,386
openvino
tests/layer_tests/pytorch_tests/test_glu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestGlu(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 4, 224, 224),) def create_model(self, dim): import to...
35
960
openvino
tests/layer_tests/pytorch_tests/test_eye.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest class TestEye(PytorchLayerTest): def _prepare_input(self, m, n=None): import numpy as np if n is None: ...
76
3,032
openvino
tests/layer_tests/pytorch_tests/test_stack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestStack2D(PytorchLayerTest): def _prepare_input(self): return self.input_tensors def create_model(self, dim=None): import torch ...
92
2,532
openvino
tests/layer_tests/pytorch_tests/test_quantized_linear.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class TestQuantizedLinear(PytorchLayerTest): def _prepare_input(self, input_shape=(2, 2)): return (np.rou...
94
4,557
openvino
tests/layer_tests/pytorch_tests/test_kthvalue.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_kthvalue(torch.nn.Module): def __init__(self, k, dim, keepdim): super().__init__() self.k = k s...
55
1,676
openvino
tests/layer_tests/pytorch_tests/test_as_strided.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestAsStrided(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(8, 8),) def create_model(s...
165
6,209
openvino
tests/layer_tests/pytorch_tests/test_quantized_add_relu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class quantized_add_relu(torch.nn.Module): def __init__(self, scale, zero_point, dtype) -> None: torch.nn...
53
1,884
openvino
tests/layer_tests/pytorch_tests/test_im2col.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestIm2Col(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(10, 3, 24, 24),) def create_model(self, kernel_size, dilation...
45
1,631
openvino
tests/layer_tests/pytorch_tests/test_log_softmax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest class aten_log_softmax(torch.nn.Module): def __init__(self, dim, dtype) -> None: super().__init__() se...
70
2,264
openvino
tests/layer_tests/pytorch_tests/test_convolution.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest d2_params = [{'weights_shape': [3, 3, 2, 2], 'strides': [1, 1], 'pads': [0, 0], 'dilations': [1, 1], 'groups': 1, 'output_padding': [0, 0], 'transposed':...
241
15,792
openvino
tests/layer_tests/pytorch_tests/test_lerp.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestLerp(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, ...
62
2,365
openvino
tests/layer_tests/pytorch_tests/test_transformer_encoder_layer.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest EMBED_DIM = 8 NUM_HEADS = 4 FFN_DIM = 16 SEQ_LENGTH = 6 BATCH_SIZE = 2 NO_MASK, ATTN_MASK, KEY_PAD_MASK, MERGED_MASK = -1, 0, 1, 2 def make_encoder_lay...
130
5,991
openvino
tests/layer_tests/pytorch_tests/test_flatten.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestFlatten(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 3, 4, 5),) def create_model(self, dim0, dim1): im...
42
1,361
openvino
tests/layer_tests/pytorch_tests/test_sort.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import torch import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSortConstants(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor,) def create_model(sel...
93
3,489
openvino
tests/layer_tests/pytorch_tests/test_dot.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestDot(PytorchLayerTest): def _prepare_input(self, inputs, dtype, out=False): import numpy as np x = np.array(inputs[0]).ast...
67
2,336
openvino
tests/layer_tests/pytorch_tests/test_sum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestSum(PytorchLayerTest): def _prepare_input(self, out=False, input_dtype="float32", out_dtype="float32", axes=None, keep_dims=None): ...
116
5,328
openvino
tests/layer_tests/pytorch_tests/test_bucketize.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestBucketize(PytorchLayerTest): def _prepare_input(self, input_shape, boundaries_range, input_dtype, boundaries_dtype): ...
54
2,355
openvino
tests/layer_tests/pytorch_tests/test_softplus.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_softplus(torch.nn.Module): def forward(self, x): return torch.nn.functional.softplus(x) class TestSoftplus(PytorchLayerTest): ...
25
663
openvino
tests/layer_tests/pytorch_tests/test_rope_pattern.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Test Rotary Position Embedding (RoPE) pattern with complex tensors. """ import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestRoPEPattern(PytorchLayerTest): """Test RoPE pattern: complex bu...
120
4,385
openvino
tests/layer_tests/pytorch_tests/test_scalar_tensor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestScalarTensor(PytorchLayerTest): def _prepare_input(self): return (np.array(self.random.randn(), dtype=np.float3...
40
1,219
openvino
tests/layer_tests/pytorch_tests/test_cat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class aten_cat(torch.nn.Module): def forward(self, x): return torch.cat(self.prepare_input(x), 1) def prepare_input(s...
330
12,288
openvino
tests/layer_tests/pytorch_tests/test_eq.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestEq(PytorchLayerTest): def _prepare_input(self): return (self.input_array.astype(self.input_type), self.other_array.astype(sel...
49
1,687
openvino
tests/layer_tests/pytorch_tests/test_roi_align.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest from torchvision.ops import roi_align class TestROIAlign(PytorchLayerTest): def _prepare_input(self): return (self.input_...
65
2,658
openvino
tests/layer_tests/pytorch_tests/test_square.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestSquareTypes(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(*self.shape, dtype=self.type),) def create...
39
1,234
openvino
tests/layer_tests/pytorch_tests/test_vstack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_vstack(torch.nn.Module): def forward(self, x): return torch.vstack(self.prepare_input(x)) de...
87
3,100
openvino
tests/layer_tests/pytorch_tests/test_grid_sampler.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestGridSampler(PytorchLayerTest): def _prepare_input(self, h_in, w_in, h_out, w_out): return (self.random.randn(1, 3, h_in, w_in)...
46
1,944
openvino
tests/layer_tests/pytorch_tests/test_logsumexp.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_logsumexp(torch.nn.Module): def __init__(self, dim, keepdim) -> None: super().__init__() self.dim = dim self.keepd...
35
1,070
openvino
tests/layer_tests/pytorch_tests/test_strided_const.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestStrides(PytorchLayerTest): def _prepare_input(self): import numpy as np x = self.random.randint(0, 10, [1, 3, 2, 2], dtype=np.float32) ...
34
1,058
openvino
tests/layer_tests/pytorch_tests/test_prod.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import random from pytorch_layer_test_class import PytorchLayerTest class aten_prod(torch.nn.Module): def __init__(self, in_dtype): super().__init__() self.in_dtype = in_dtype def fo...
88
2,970
openvino
tests/layer_tests/pytorch_tests/test_elu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_elu(torch.nn.Module): def __init__(self, alpha, dtype, inplace): super().__init__(...
45
1,503
openvino
tests/layer_tests/pytorch_tests/test_aliases.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_alias(torch.nn.Module): def forward(self, x): y = x.clone() y[:, 1, :, :] = 4. return y class aten_alias_tensor(...
67
2,200
openvino
tests/layer_tests/pytorch_tests/test_min_max.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestMinMax(PytorchLayerTest): def _prepare_input(self, input_dtype="float32", second_input=False, second_input_dtype="float32"): imp...
352
14,153
openvino
tests/layer_tests/pytorch_tests/test_bincount.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestBincount(PytorchLayerTest): def _prepare_input(self, input_data, i_dtype, w_dtype, with_weights): inputs = (np....
70
2,456
openvino
tests/layer_tests/pytorch_tests/test_var_mean.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestVarMean(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 3, 224, 224),) def create_model(self, un...
76
2,938
openvino
tests/layer_tests/pytorch_tests/test_fmod.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestFmodTypes(PytorchLayerTest): def _prepare_input(self): if len(self.lhs_shape) == 0: return (self.random.randint(2, 5, ...
75
3,385
openvino
tests/layer_tests/pytorch_tests/test_add.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_check @pytest.mark.parametrize('alpha', (-0.5, 0, 0.5, 1, 2)) @pytest.mark.parametrize('input_shape_rhs', [ [2, 5, 3, 4], [1, 5, 3, 4], ...
311
12,195
openvino
tests/layer_tests/pytorch_tests/test_randperm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class TestSortedRandperm(PytorchLayerTest): def _prepare_input(self): return (np.arange(self.n, dtype=np.int64),) def c...
50
1,921
openvino
tests/layer_tests/pytorch_tests/test_item.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize("dtype", [pytest.param(np.int32, marks=pytest.mark.xfail(reason="item returns scalar and for i32 it returns i...
36
1,318
openvino
tests/layer_tests/pytorch_tests/test_neg.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class neg_model(torch.nn.Module): def forward(self, x): return x * (-x.shape[-1]) class TestNeg(PytorchLayerTest): def _prepare_input(s...
30
906
openvino
tests/layer_tests/pytorch_tests/test_adaptive_max_pool.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest class TestAdaptiveMaxPool3D(PytorchLayerTest): def _prepare_input(self): return (self.input...
147
5,707
openvino
tests/layer_tests/pytorch_tests/test_addcmul.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestAddCMul(PytorchLayerTest): def _prepare_input(self): return (self.random.uniform(0, 50, 3, dtype=self.input_type), ...
53
1,632
openvino
tests/layer_tests/pytorch_tests/test_layer_norm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestLayerNorm(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(20, 5, 10, 10),) def create_model(self, normalized_shape, ...
97
3,707
openvino
tests/layer_tests/pytorch_tests/test_inverse.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_inverse(torch.nn.Module): def __init__(self) -> None: torch.nn.Module.__init__(self) def forward(self, inp...
112
3,320
openvino
tests/layer_tests/pytorch_tests/test_hstack.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np import numpy as np from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_hstack(torch.nn.Module): def forward(self, x): return torch.hstack(self.prepa...
89
3,120
openvino
tests/layer_tests/pytorch_tests/test_tile.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestTile(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, dims): import ...
33
911
openvino
tests/layer_tests/pytorch_tests/test_dict.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestDict(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, 4),) def create_model(se...
89
3,252
openvino
tests/layer_tests/pytorch_tests/test_topk.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestTopK(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor,) def create_model(self, k, dim, largest, sort): import ...
65
1,902
openvino
tests/layer_tests/pytorch_tests/test_permute.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPermute(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224, 224),) def create_model(self, order, complex_type...
95
3,369
openvino
tests/layer_tests/pytorch_tests/test_one_hot.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestOneHot(PytorchLayerTest): def _prepare_input(self): return (self.random.randint(0, 100, (1,1000), dtype=np.int32),) def ...
34
1,060
openvino
tests/layer_tests/pytorch_tests/test_logaddexp.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import numpy as np from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestLogAddExp(PytorchLayerTest): def _prepare_input(self, input1, input2, dtype1="float32", dtype2="float32", out=False): ...
150
4,819
openvino
tests/layer_tests/pytorch_tests/test_nonzero.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest from pytorch_layer_test_class import PytorchLayerTest class TestNonZero(PytorchLayerTest): def _prepare_input(self, mask_fill='ones', mask_dtype=bool): input_shape = [2, 10, 2] mask...
50
1,705
openvino
tests/layer_tests/pytorch_tests/test_split_amax.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestSplitAmax(PytorchLayerTest): """Test case for split_with_sizes followed by amax operation. This test reproduces the issue where Sequen...
184
6,378
openvino
tests/layer_tests/pytorch_tests/test_xor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestXor(PytorchLayerTest): def _prepare_input(self): return self.input_data def create_model_tensor_input(self)...
84
2,882
openvino
tests/layer_tests/pytorch_tests/test_take_along_dim.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestTakeAlongDim(PytorchLayerTest): def _prepare_input(self, m, n, max_val, out=False, flattenize=False): import numpy as np ...
57
2,255
openvino
tests/layer_tests/pytorch_tests/test_split.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestSplit(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 10, 224, 224),) def create_mod...
151
5,343
openvino
tests/layer_tests/pytorch_tests/test_shape_as_tensor.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_shape_as_tensor(torch.nn.Module): def __init__(self) -> None: torch.nn.Module.__init__(self) def forward(se...
33
912
openvino
tests/layer_tests/pytorch_tests/test_celu.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import torch.nn.functional as F from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class aten_celu(torch.nn.Module): def __init__(self, alpha, dtype, inplace): super().__init__...
45
1,511
openvino
tests/layer_tests/pytorch_tests/test_lstm.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest # torch.nn.modules.rnn performs tensor-to-bool shape checks (input_size and # hidden_size validation) inside the traced forward pass. T...
207
8,764
openvino
tests/layer_tests/pytorch_tests/test_outer.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestOuter(PytorchLayerTest): def _prepare_input(self, x_shape, y_shape, x_dtype, y_dtype, out=False): import numpy as np x =...
57
2,211
openvino
tests/layer_tests/pytorch_tests/test_chunk.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class aten_chunk_2(torch.nn.Module): def __init__(self, dim, unsafe=False) -> None: torch.nn.Module.__init__(self) self.dim = dim ...
190
5,998
openvino
tests/layer_tests/pytorch_tests/test_flip.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestFlip(PytorchLayerTest): def _prepare_input(self, out=False, dtype="float32"): import numpy as np x = self.random.randn(2...
44
1,506
openvino
tests/layer_tests/pytorch_tests/test_constant_pad_nd.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestConstantPadND(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, 4),) def create_model(self, pad, value): ...
36
1,163
openvino
tests/layer_tests/pytorch_tests/test_index_copy_.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestIndexCopy(PytorchLayerTest): def _prepare_input(self): return (self.input_tensor, self.values) def create_mod...
90
3,136
openvino
tests/layer_tests/pytorch_tests/test_complex.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestComplex(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2),) def create_model(self, dtype): cla...
78
2,615
openvino
tests/layer_tests/pytorch_tests/test_squeeze.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSqueeze(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 1, 32),) def create_model(self, dim): import torc...
73
2,734
openvino
tests/layer_tests/pytorch_tests/test_rad2deg.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch import numpy as np from pytorch_layer_test_class import PytorchLayerTest class TestRad2Deg(PytorchLayerTest): def _prepare_input(self, input_shape=(2, 2), dtype=np.float32): return (self.random.un...
27
1,035
openvino
tests/layer_tests/pytorch_tests/test_repeat.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestRepeat(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 10),) def create_model(self, repeats): import torc...
85
2,910
openvino
tests/layer_tests/pytorch_tests/test_stft.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from packaging import version from pytorch_layer_test_class import PytorchLayerTest # stft with return_complex=False is deprecated in PyTorch 2.9. # return_complex=True is already tested in TestSTFTAttrs. _ST...
162
7,424
openvino
tests/layer_tests/pytorch_tests/test_unsqueeze.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest, skip_if_export class TestUnsqueeze(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(5, 10),) def create_model(self, inplace=Fa...
111
3,708
openvino
tests/layer_tests/pytorch_tests/test_select.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest @pytest.mark.parametrize('input_dim', list(range(-3, 4))) @pytest.mark.parametrize('input_index', list(range(-3, 4))) class TestSelect(PytorchLayerTest):...
66
2,231
openvino
tests/layer_tests/pytorch_tests/test_expand.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import random import pytest from pytorch_layer_test_class import PytorchLayerTest class TestExpand(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3),) def create_model(self, dim, op_type="ex...
195
6,809
openvino
tests/layer_tests/pytorch_tests/test_matmul.py
.py
import numpy as np import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestMatMulOperation(PytorchLayerTest): def _prepare_input(self, matrix, vector): return matrix, vector def create_model(self): class CustomMatMulOperation(torch.nn.Module): de...
43
1,559
openvino
tests/layer_tests/pytorch_tests/test_einsum.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestEinsumBatchMatMul(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(5, 2, 3), self.random.randn(5, 3, 4),) def create_...
92
2,708
openvino
tests/layer_tests/pytorch_tests/test_slice_scatter.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestSliceScatter(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(2, 5, 3, 4),) def create_model(self, src, dim, start, ...
41
1,374
openvino
tests/layer_tests/pytorch_tests/test_argmax_argmin.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestArgMinArgMax(PytorchLayerTest): def _prepare_input(self, dtype="float32"): a = self.random.randn(1, 3, 10, 10, dtype=dtype) ...
84
2,718
openvino
tests/layer_tests/pytorch_tests/test_pooling.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest import torch import openvino as ov from pytorch_layer_test_class import PytorchLayerTest import numpy as np d2_params = [{'kernel_size': [3, 3], 'stride': 1, 'padding': 0}, {'kernel_size': [3...
498
28,061
openvino
tests/layer_tests/pytorch_tests/test_conv_transposend.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestConvTranspose2D(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 10, 10),) def create_model(self, weights_shape...
194
10,582
openvino
tests/layer_tests/pytorch_tests/test_pythonop.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestPythonOp(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 128, 128),) def create_model(self): import to...
55
1,429
openvino
tests/layer_tests/pytorch_tests/test_upsample.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 from sys import platform import pytest from pytorch_layer_test_class import PytorchLayerTest class TestUpsample1D(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(1, 3, 224),) def create_model(s...
248
8,515
openvino
tests/layer_tests/pytorch_tests/test_unflatten.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest from pytorch_layer_test_class import PytorchLayerTest class TestUnflatten(PytorchLayerTest): def _prepare_input(self, dtype): return (self.random.uniform(0, 50, (6, 3, 4), dtype=dtype),) def create_model...
69
2,360
openvino
tests/layer_tests/pytorch_tests/test_fork_wait.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pytest import torch from pytorch_layer_test_class import PytorchLayerTest class TestForkWait(PytorchLayerTest): def _prepare_input(self): return (self.random.randn(10, 20),) def create_model(self): cl...
38
1,077
openvino
tests/layer_tests/pytorch_tests/test_loop.py
.py
# Copyright (C) 2018-2026 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import platform import pytest from pytorch_layer_test_class import PytorchLayerTest import torch class TestWhileLoopFX(PytorchLayerTest): """Tests for torch.while_loop support in FX export (torch.export).""" def _prepare_inpu...
132
4,835