Skip to content

Commit

Permalink
Merge pull request openvinotoolkit#62 from eaidova/ea/clone
Browse files Browse the repository at this point in the history
ignore aten::clone
  • Loading branch information
slyalin authored Dec 14, 2022
2 parents 3256076 + 15d9ba4 commit 6e4c5c9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/frontends/pytorch/src/op_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const std::map<std::string, CreatorFunction> get_supported_ops() {
{"aten::clamp", op::translate_clamp},
{"aten::clamp_min", op::translate_1to1_match_2_inputs<opset8::Maximum>},
{"aten::clamp_max", op::translate_1to1_match_2_inputs<opset8::Minimum>},
{"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},
Expand Down Expand Up @@ -184,7 +185,8 @@ const std::map<std::string, CreatorFunction> get_supported_ops() {
{"aten::sub", op::translate_sub},
{"aten::sum", op::translate_sum},
{"aten::tanh", op::translate_1to1_match_1_inputs<opset8::Tanh>},
{"aten::type_as", op::translate_1to1_match_2_inputs<opset8::ConvertLike>}, // TODO: overflow semantics is different
{"aten::type_as",
op::translate_1to1_match_2_inputs<opset8::ConvertLike>}, // TODO: overflow semantics is different
{"aten::to", op::translate_to},
{"aten::transpose", op::translate_transpose},
{"aten::unsqueeze", op::translate_1to1_match_2_inputs<opset8::Unsqueeze>},
Expand Down
27 changes: 27 additions & 0 deletions tests/layer_tests/pytorch_tests/test_clone.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 6e4c5c9

Please sign in to comment.