Add support for concatenation in Loop (#15899)
* Add support for concatenation in Loop * Apply suggestions from code review * Fix win build * Fix issues with propagation shapes and types in Loop * Fix einsum * Set type and shape of count in frontend
This commit is contained in:
1 parent
62ff31df8a
commit
87e714eb5c
10 files changed
+159
-19
No files matched your search
@@ -52,7 +52,8 @@ class PytorchLayerTest:
|
||||
else:
|
||||
torch_inputs = [torch.from_numpy(inp) for inp in inputs]
|
||||
model = torch.jit.trace(model, torch_inputs)
|
||||
model = torch.jit.freeze(model)
|
||||
if kwargs.get('freeze_model', True):
|
||||
model = torch.jit.freeze(model)
|
||||
graph = model.inlined_graph
|
||||
print(graph)
|
||||
|
||||
|
||||
@@ -32,5 +32,5 @@ class TestBool(PytorchLayerTest):
|
||||
@pytest.mark.parametrize("input_type", ["tensor", "scalar"])
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_ceil(self, ie_device, precision, ir_version, input_type):
|
||||
def test_bool(self, ie_device, precision, ir_version, input_type):
|
||||
self._test(*self.create_model(input_type), ie_device, precision, ir_version)
|
||||
@@ -0,0 +1,51 @@
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
import torch
|
||||
|
||||
from pytorch_layer_test_class import PytorchLayerTest
|
||||
|
||||
|
||||
class aten_cat(torch.nn.Module):
|
||||
def forward(self, x):
|
||||
return torch.cat([x, x], 1)
|
||||
|
||||
|
||||
class aten_append_cat(torch.nn.Module):
|
||||
def forward(self, x):
|
||||
list = []
|
||||
list.append(x)
|
||||
list.append(x)
|
||||
return torch.cat(list, 1)
|
||||
|
||||
class aten_loop_append_cat(torch.nn.Module):
|
||||
def forward(self, x):
|
||||
list = []
|
||||
for i in range(3):
|
||||
list.append(x)
|
||||
return torch.cat(list, 1)
|
||||
|
||||
|
||||
class TestCat(PytorchLayerTest):
|
||||
def _prepare_input(self):
|
||||
import numpy as np
|
||||
return (np.random.randn(2, 1, 3),)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_cat(self, ie_device, precision, ir_version):
|
||||
self._test(aten_cat(), None, ["aten::cat", "prim::ListConstruct"],
|
||||
ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_append_cat(self, ie_device, precision, ir_version):
|
||||
self._test(aten_append_cat(), None, ["aten::cat", "aten::append", "prim::ListConstruct"],
|
||||
ie_device, precision, ir_version)
|
||||
|
||||
@pytest.mark.nightly
|
||||
@pytest.mark.precommit
|
||||
def test_loop_append_cat(self, ie_device, precision, ir_version):
|
||||
self._test(aten_loop_append_cat(), None, ["aten::cat", "aten::append", "prim::ListConstruct", "prim::Loop"],
|
||||
ie_device, precision, ir_version, freeze_model=False)
|
||||
Reference in new issue
Block a user