forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4830b78
commit 3f95242
Showing
15 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import pytest | ||
|
||
from pytorch_layer_test_class import PytorchLayerTest | ||
|
||
|
||
class TestAny(PytorchLayerTest): | ||
def _prepare_input(self): | ||
import numpy as np | ||
return ((np.random.randint(2, size=(3,3,10,10)) > 0),) | ||
|
||
def create_model(self, dim, keep_dim): | ||
|
||
import torch | ||
class aten_any(torch.nn.Module): | ||
def __init__(self, dim=None, keep_dim=None): | ||
super(aten_any, self).__init__() | ||
self.dim = dim | ||
self.keep_dim = keep_dim | ||
|
||
def forward(self, x): | ||
return torch.any(x, dim=self.dim, keepdim=self.keep_dim) | ||
|
||
|
||
ref_net = None | ||
|
||
return aten_any(dim, keep_dim), ref_net, "aten::any" | ||
|
||
@pytest.mark.parametrize(("dim", "keep_dim"), | ||
[(0, False), (0, True), (-1, True)]) | ||
|
||
@pytest.mark.precommit_fx_backend | ||
def test_any(self, dim, keep_dim, ie_device, precision, ir_version): | ||
self._test(*self.create_model(dim, keep_dim), | ||
ie_device, precision, ir_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import pytest | ||
|
||
from pytorch_layer_test_class import PytorchLayerTest | ||
|
||
|
||
class TestConstantPadND(PytorchLayerTest): | ||
def _prepare_input(self): | ||
import numpy as np | ||
return (np.random.randn(2, 5, 3, 4).astype(np.float32),) | ||
|
||
def create_model(self, pad, value): | ||
|
||
import torch | ||
class aten_constant_pad_nd(torch.nn.Module): | ||
def __init__(self, pad=None, value=None): | ||
super(aten_constant_pad_nd, self).__init__() | ||
self.pad = pad | ||
self.value = value | ||
|
||
def forward(self, x): | ||
return torch.constant_pad_nd(x, self.pad, self.value); | ||
|
||
|
||
ref_net = None | ||
|
||
return aten_constant_pad_nd(pad, value), ref_net, "aten::constant_pad_nd" | ||
|
||
@pytest.mark.parametrize(("pad", "value"), | ||
[((1,1,1,1), 0),((0,2,0,2), -1.0),((3,1,5,2), 0.5),((0,0,0,0), 0),]) | ||
|
||
@pytest.mark.precommit_fx_backend | ||
def test_constant_pad_nd(self, pad, value, ie_device, precision, ir_version): | ||
self._test(*self.create_model(pad, value), | ||
ie_device, precision, ir_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import pytest | ||
|
||
from pytorch_layer_test_class import PytorchLayerTest | ||
|
||
|
||
|
||
class TestSelectScatter(PytorchLayerTest): | ||
def _prepare_input(self): | ||
import numpy as np | ||
return (np.random.randn(2, 5, 3, 4).astype(np.float32),) | ||
|
||
def create_model(self, src, dim, index): | ||
|
||
import torch | ||
class aten_select_scatter(torch.nn.Module): | ||
def __init__(self, src=None, dim=None, index=None): | ||
super(aten_select_scatter, self).__init__() | ||
self.src = src | ||
self.dim = dim | ||
self.index = index | ||
|
||
def forward(self, x): | ||
return torch.select_scatter(x, self.src, self.dim, self.index); | ||
|
||
|
||
ref_net = None | ||
|
||
return aten_select_scatter(src, dim, index), ref_net, "aten::select_scatter" | ||
|
||
import torch | ||
@pytest.mark.precommit_fx_backend | ||
@pytest.mark.parametrize(("src", "dim", "index"), | ||
[(torch.ones(2), 0, 0),]) | ||
def aten_select_scatter(self, src, dim, index, ie_device, precision, ir_version): | ||
self._test(*self.create_model(src, dim, index), | ||
ie_device, precision, ir_version) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (C) 2018-2023 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
import pytest | ||
|
||
from pytorch_layer_test_class import PytorchLayerTest | ||
|
||
|
||
|
||
class TestSliceScatter(PytorchLayerTest): | ||
def _prepare_input(self): | ||
import numpy as np | ||
return (np.random.randn(2, 5, 3, 4).astype(np.float32),) | ||
|
||
def create_model(self, src, dim, start, end, step): | ||
|
||
import torch | ||
class aten_slice_scatter(torch.nn.Module): | ||
def __init__(self, src=None, dim=None, start=None, end=None, step=None): | ||
super(aten_slice_scatter, self).__init__() | ||
self.src = src | ||
self.dim = dim | ||
self.start = start | ||
self.end = end | ||
self.step = step | ||
|
||
def forward(self, x): | ||
return torch.slice_scatter(x, src=self.src, dim=self.dim, start=self.start, end=self.end, step=self.step); | ||
|
||
|
||
ref_net = None | ||
|
||
return aten_slice_scatter(src, dim, start, end, step), ref_net, "aten::slice_scatter" | ||
|
||
import torch | ||
@pytest.mark.precommit_fx_backend | ||
@pytest.mark.parametrize(("src", "dim", "start", "end", "step"), | ||
[(torch.ones(2), 1, 1, 2, 1),]) | ||
def aten_slice_scatter(self, src, dim, start, end, step, ie_device, precision, ir_version): | ||
self._test(*self.create_model(src, dim, start, end, step), | ||
ie_device, precision, ir_version) |