[PT FE] Add aten::__and__ operator with layer test (#15365)
* Layer test for aten::__add__ operator * Not working version of aten::__and__ * Simplified implementation of ante::__and__ operator * Fix file format
This commit is contained in:
1 parent
3a1159eb5f
commit
949b9623a4
2 files changed
+57
No files matched your search
@@ -111,6 +111,7 @@ OP_CONVERTER(translate_zeros_like);
|
||||
|
||||
const std::map<std::string, CreatorFunction> get_supported_ops() {
|
||||
return {
|
||||
{"aten::__and__", op::translate_1to1_match_2_inputs<opset10::LogicalAnd>}, // TODO: cover numerical cases
|
||||
{"aten::__not__", op::translate_1to1_match_1_inputs<opset10::LogicalNot>},
|
||||
{"aten::_convolution", op::translate_convolution},
|
||||
{"aten::_convolution_mode", op::translate_convolution_mode},
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
# 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 TestAnd(PytorchLayerTest):
|
||||
|
||||
def _prepare_input(self):
|
||||
return self.input_data
|
||||
|
||||
def create_model_tensor_input(self):
|
||||
class aten_and_tensor(torch.nn.Module):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def forward(self, tensor_a, tensor_b):
|
||||
return tensor_a & tensor_b
|
||||
|
||||
ref_net = None
|
||||
|
||||
return aten_and_tensor(), ref_net, "aten::__and__"
|
||||
|
||||
def create_model_bool_input(self):
|
||||
class aten_and_bool(torch.nn.Module):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
|
||||
def forward(self, bool_a: bool, bool_b: bool):
|
||||
return bool_a & bool_b
|
||||
|
||||
ref_net = None
|
||||
|
||||
return aten_and_bool(), ref_net, "aten::__and__"
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_and_tensor(self, ie_device, precision, ir_version):
|
||||
self.input_data = (np.array([True, False, False], dtype=np.bool_), np.array(
|
||||
[True, True, False], dtype=np.bool_))
|
||||
self._test(*self.create_model_tensor_input(),
|
||||
ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_and_bool(self, ie_device, precision, ir_version):
|
||||
self.input_data = (np.array(True, dtype=np.bool_),
|
||||
np.array(True, dtype=np.bool_))
|
||||
self._test(*self.create_model_bool_input(),
|
||||
ie_device, precision, ir_version)
|
||||
Reference in new issue
Block a user