* test * fixed tests * typo * fixed tests * rest of the tests * fixed rsub test * tmp fix * Revert "tmp fix" This reverts commit b8bf1e9492e13497895da488612c9a137ef840bc. * fixed test params * reset thirdparty/pugixml * Revert "fixed rsub test" This reverts commit 9b6be34b8666936e8124b6622fcc5185b640de92. * fixed typo * fixed test data * reset test_rsub * removed unused param * reverrted runner * simplified call * fixed random * changed logical to auto mode * Revert "fixed random" This reverts commit 8a4f20b24641144f823a7e1f1ff92038634acf32. * fixed test_all * replaced random_sample with randn * fixed rebase issue * reverted logical splitting * Update tests/layer_tests/pytorch_tests/test_repeat_interleave.py Co-authored-by: Maxim Vafin <maxim.vafin@intel.com> * Update tests/layer_tests/pytorch_tests/test_all.py Co-authored-by: Maxim Vafin <maxim.vafin@intel.com> * Apply suggestions from code review Co-authored-by: Maxim Vafin <maxim.vafin@intel.com> * fixed merge conflict --------- Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
45 lines
1.4 KiB
Python
45 lines
1.4 KiB
Python
# Copyright (C) 2018-2023 Intel Corporation
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
import numpy as np
|
|
import pytest
|
|
import torch
|
|
|
|
from pytorch_layer_test_class import PytorchLayerTest
|
|
|
|
|
|
class TestNarrow(PytorchLayerTest):
|
|
def _prepare_input(self):
|
|
return (self.input_tensor, self.dim, self.start, self.length)
|
|
|
|
def create_model(self):
|
|
|
|
class aten_narrow(torch.nn.Module):
|
|
|
|
def forward(self, input_tensor, dim: int, start, length: int):
|
|
return torch.narrow(input_tensor, dim=dim, start=start, length=length)
|
|
|
|
ref_net = None
|
|
|
|
return aten_narrow(), ref_net, "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.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) |