Files
openvino/tests/layer_tests/pytorch_tests/test_aliases.py
T
Maxim Vafin a6bc78dd0f [PT FE] Separate tracing and scripting modes (#19676)
* [PT FE] Separate scripting and tracing in decoder

* Fix convert_model to accept decoder

* Some fixes

* Fix code style

* Fix preprocessor tests

* Fix tests

* Fix tests

* Fix more tests

* Fix ovc tests
2023-09-12 12:40:20 +04:00

44 lines
1.3 KiB
Python

# Copyright (C) 2018-2023 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):
x[:, 1, :, :] = 4.
return x
class aten_loop_alias(torch.nn.Module):
def forward(self, x):
for i in range(2):
x[:, i, :, :] = 4.
return x
class TestAliases(PytorchLayerTest):
def _prepare_input(self):
import numpy as np
return (np.random.randn(1, 3, 224, 224).astype(np.float32),)
@pytest.mark.nightly
@pytest.mark.precommit
def test_alias(self, ie_device, precision, ir_version):
self._test(aten_alias(), None, ["aten::slice",
"aten::select",
"aten::copy_"],
ie_device, precision, ir_version)
@pytest.mark.nightly
@pytest.mark.precommit
def test_loop_alias(self, ie_device, precision, ir_version):
self._test(aten_loop_alias(), None, ["aten::slice",
"aten::select",
"aten::copy_",
"prim::Loop"],
ie_device, precision, ir_version, freeze_model=False)