Remove None at outputs of the model, improve types handling in frontend (#15258)
* Remove None at outputs of the model, improve types handling in frontend * Fix py code style * Add torch dependency in pybind tests * Fix tests if fe is disabled and add backward type cpnversion * Move decoder tests to layer tests * Fix codestyle * Add comment * Move tests to separate folder * Update .ci/azure/linux.yml
This commit is contained in:
45
tests/layer_tests/pytorch_tests/test_tuple_construct.py
Normal file
45
tests/layer_tests/pytorch_tests/test_tuple_construct.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# Copyright (C) 2018-2023 Intel Corporation
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
import numpy as np
|
||||
from pytorch_layer_test_class import PytorchLayerTest
|
||||
|
||||
|
||||
class TestTupleConstruct(PytorchLayerTest):
|
||||
def _prepare_input(self):
|
||||
return (np.random.uniform(0, 50, (1, 10)).astype(np.float32),)
|
||||
|
||||
def create_model(self, case):
|
||||
import torch
|
||||
|
||||
class prim_tuple_construct_single_value(torch.nn.Module):
|
||||
|
||||
def forward(self, x):
|
||||
return (x,)
|
||||
|
||||
class prim_tuple_construct(torch.nn.Module):
|
||||
|
||||
def forward(self, x):
|
||||
return (x, x + x)
|
||||
|
||||
class prim_tuple_construct_with_none(torch.nn.Module):
|
||||
|
||||
def forward(self, x):
|
||||
return (x, None, x + x, None)
|
||||
|
||||
cases = {
|
||||
"single": prim_tuple_construct_single_value,
|
||||
"multiple": prim_tuple_construct,
|
||||
"none": prim_tuple_construct_with_none
|
||||
}
|
||||
|
||||
ref_net = None
|
||||
model = cases[case]
|
||||
|
||||
return model(), ref_net, "prim::TupleConstruct"
|
||||
|
||||
@pytest.mark.parametrize("case", ["single", "multiple", "none"])
|
||||
@pytest.mark.nightly
|
||||
def test_tuple_construct(self, case, ie_device, precision, ir_version):
|
||||
self._test(*self.create_model(case), ie_device, precision, ir_version)
|
||||
Reference in New Issue
Block a user