From 7d55e38ba2b27168833fd796af15c0b4f3eb96d6 Mon Sep 17 00:00:00 2001 From: eaidova Date: Fri, 9 Dec 2022 06:12:21 -0500 Subject: [PATCH 1/2] ignore aten::clone --- src/frontends/pytorch/src/op_table.cpp | 1 + tests/layer_tests/pytorch_tests/test_clone.py | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/layer_tests/pytorch_tests/test_clone.py diff --git a/src/frontends/pytorch/src/op_table.cpp b/src/frontends/pytorch/src/op_table.cpp index 79f007cb73658c..03ced45ace3473 100644 --- a/src/frontends/pytorch/src/op_table.cpp +++ b/src/frontends/pytorch/src/op_table.cpp @@ -103,6 +103,7 @@ const std::map get_supported_ops() { {"aten::clamp", op::translate_clamp}, {"aten::clamp_min", op::translate_1to1_match_2_inputs}, {"aten::clamp_max", op::translate_1to1_match_2_inputs}, + {"aten::clone", op::skip_node}, // ignore clone operators that are inserted by PyTorch autograd {"aten::contiguous", op::skip_node}, // In openvino how tensors are stored in memory is internal plugin detail, // we assume all tensors are contiguous {"aten::conv2d", op::translate_conv2d}, diff --git a/tests/layer_tests/pytorch_tests/test_clone.py b/tests/layer_tests/pytorch_tests/test_clone.py new file mode 100644 index 00000000000000..a7568e4e7a9e59 --- /dev/null +++ b/tests/layer_tests/pytorch_tests/test_clone.py @@ -0,0 +1,27 @@ +# Copyright (C) 2018-2022 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import pytest +from pytorch_layer_test_class import PytorchLayerTest + + +class TestClone(PytorchLayerTest): + def _prepare_input(self): + import numpy as np + return (np.random.randn(1, 3, 224, 224).astype(np.float32),) + + def create_model(self): + import torch + + class aten_clone(torch.nn.Module): + + def forward(self, x): + return torch.clone(x) + + ref_net = None + + return aten_clone(), ref_net, "aten::clone" + + @pytest.mark.nightly + def test_clone(self, ie_device, precision, ir_version): + self._test(*self.create_model(), ie_device, precision, ir_version) From 15d9ba4a0e756c2c62c627a4fb2871eac48f8999 Mon Sep 17 00:00:00 2001 From: Aidova Date: Tue, 13 Dec 2022 15:42:06 +0400 Subject: [PATCH 2/2] fix code style --- src/frontends/pytorch/src/op_table.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/frontends/pytorch/src/op_table.cpp b/src/frontends/pytorch/src/op_table.cpp index 03ced45ace3473..5f47b3acb10785 100644 --- a/src/frontends/pytorch/src/op_table.cpp +++ b/src/frontends/pytorch/src/op_table.cpp @@ -103,7 +103,7 @@ const std::map get_supported_ops() { {"aten::clamp", op::translate_clamp}, {"aten::clamp_min", op::translate_1to1_match_2_inputs}, {"aten::clamp_max", op::translate_1to1_match_2_inputs}, - {"aten::clone", op::skip_node}, // ignore clone operators that are inserted by PyTorch autograd + {"aten::clone", op::skip_node}, // ignore clone operators that are inserted by PyTorch autograd {"aten::contiguous", op::skip_node}, // In openvino how tensors are stored in memory is internal plugin detail, // we assume all tensors are contiguous {"aten::conv2d", op::translate_conv2d}, @@ -182,7 +182,8 @@ const std::map get_supported_ops() { {"aten::sub", op::translate_sub}, {"aten::sum", op::translate_sum}, {"aten::tanh", op::translate_1to1_match_1_inputs}, - {"aten::type_as", op::translate_1to1_match_2_inputs}, // TODO: overflow semantics is different + {"aten::type_as", + op::translate_1to1_match_2_inputs}, // TODO: overflow semantics is different {"aten::to", op::translate_to}, {"aten::transpose", op::translate_transpose}, {"aten::unsqueeze", op::translate_1to1_match_2_inputs},