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.
TorchFX unit tests: index_select, unary_ops, isinf, isnan
- Loading branch information
1 parent
33da1ba
commit a3f919a
Showing
4 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# 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 | ||
|
||
|
||
@pytest.mark.parametrize('input_tensor', (torch.tensor([1, float('inf'), 2, float('-inf'), float('nan')]))) | ||
class TestIsInf(PytorchLayerTest): | ||
|
||
def _prepare_input(self): | ||
input_tensor = self.input_tensor | ||
return (input_tensor,) | ||
|
||
def create_model(self): | ||
class aten_isinf(torch.nn.Module): | ||
|
||
def forward(self, input_tensor): | ||
return torch.isinf(input_tensor) | ||
|
||
ref_net = None | ||
|
||
return aten_isinf(), ref_net, "aten::isinf" | ||
|
||
@pytest.mark.nightly | ||
@pytest.mark.precommit | ||
@pytest.mark.precommit_fx_backend | ||
def test_isinf(self, ie_device, precision, ir_version, input_tensor): | ||
self.input_tensor = input_tensor | ||
self._test(*self.create_model(), 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,33 @@ | ||
# 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 | ||
|
||
|
||
@pytest.mark.parametrize('input_tensor', (torch.tensor([1, float('nan'), 2]))) | ||
class TestIsNan(PytorchLayerTest): | ||
|
||
def _prepare_input(self): | ||
input_tensor = self.input_tensor | ||
return (input_tensor,) | ||
|
||
def create_model(self): | ||
class aten_isnan(torch.nn.Module): | ||
|
||
def forward(self, input_tensor): | ||
return torch.isnan(input_tensor) | ||
|
||
ref_net = None | ||
|
||
return aten_isnan(), ref_net, "aten::isnan" | ||
|
||
@pytest.mark.nightly | ||
@pytest.mark.precommit | ||
@pytest.mark.precommit_fx_backend | ||
def test_isnan(self, ie_device, precision, ir_version, input_tensor): | ||
self.input_tensor = input_tensor | ||
self._test(*self.create_model(), 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