From 24abb24d394c23464d2e313aa7de936e57a9dd53 Mon Sep 17 00:00:00 2001 From: Oleg Pipikin Date: Tue, 8 Aug 2023 14:13:42 +0400 Subject: [PATCH] Eliminate makeInputLayer usage --- .../convolution_biasadd_activation.hpp | 3 +- .../single_layer_tests/fully_connected.cpp | 29 ++++++++++++------- .../tests/unit/test_networks.hpp | 6 ++-- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/convolution_biasadd_activation.hpp b/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/convolution_biasadd_activation.hpp index 627628aca9..7b6fe0f07e 100644 --- a/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/convolution_biasadd_activation.hpp +++ b/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/convolution_biasadd_activation.hpp @@ -120,8 +120,7 @@ class BasicConvolutionBiasAddActivationLayerTest for (size_t i = 0; i < biasShape.size(); ++i) { if (i != channel_dim_index) biasShape[i] = 1; } - auto biasLayer = - ngraph::builder::makeInputLayer(ngNetPrc, ngraph::helpers::InputLayerType::CONSTANT, biasShape); + auto biasLayer = std::make_shared(ngNetPrc, biasShape); auto biasAddLayer = ngraph::builder::makeEltwise(convLayer, biasLayer, ngraph::helpers::EltwiseTypes::ADD); diff --git a/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/fully_connected.cpp b/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/fully_connected.cpp index bd74352d68..bd3e364e3f 100644 --- a/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/fully_connected.cpp +++ b/modules/nvidia_plugin/tests/functional/shared_tests_instances/single_layer_tests/fully_connected.cpp @@ -85,13 +85,14 @@ class FullyConnectedLayerTest : public testing::WithParamInterface secondaryInput; if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) { - params.push_back(std::dynamic_pointer_cast(secondaryInput)); + secondaryInput = std::make_shared(ngPrc, shapeRelatedParams.input2.first); + params.push_back(std::static_pointer_cast(secondaryInput)); + } else { + secondaryInput = std::make_shared(ngPrc, shapeRelatedParams.input2.first); } - auto thirdInput = ngraph::builder::makeInputLayer( - ngPrc, ngraph::helpers::InputLayerType::CONSTANT, shapeRelatedParams.input3); + auto thirdInput = std::make_shared(ngPrc, shapeRelatedParams.input3); auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); auto MatMul = std::dynamic_pointer_cast(ngraph::builder::makeMatMul( @@ -191,15 +192,21 @@ class FullyConnectedLayer2MatMulTest : public testing::WithParamInterface matmul0SecondaryInput; if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) { - params.push_back(std::dynamic_pointer_cast(matmul0SecondaryInput)); + matmul0SecondaryInput = std::make_shared(ngPrc, shapeRelatedParams.matmul1_input2.first); + params.push_back(std::static_pointer_cast(matmul0SecondaryInput)); + } else { + matmul0SecondaryInput = std::make_shared(ngPrc, shapeRelatedParams.matmul1_input2.first); } - auto matmul1SecondaryInput = - ngraph::builder::makeInputLayer(ngPrc, secondaryInputType, shapeRelatedParams.matmul2_input2.first); + + std::shared_ptr matmul1SecondaryInput; if (secondaryInputType == ngraph::helpers::InputLayerType::PARAMETER) { - params.push_back(std::dynamic_pointer_cast(matmul1SecondaryInput)); + matmul1SecondaryInput = std::make_shared(ngPrc, shapeRelatedParams.matmul1_input2.first); + params.push_back(std::static_pointer_cast(matmul1SecondaryInput)); + } else { + matmul1SecondaryInput = std::make_shared(ngPrc, shapeRelatedParams.matmul1_input2.first); } auto paramOuts = diff --git a/modules/nvidia_plugin/tests/unit/test_networks.hpp b/modules/nvidia_plugin/tests/unit/test_networks.hpp index 667f7b8c58..1fc49006f8 100644 --- a/modules/nvidia_plugin/tests/unit/test_networks.hpp +++ b/modules/nvidia_plugin/tests/unit/test_networks.hpp @@ -9,14 +9,13 @@ #include inline std::shared_ptr CreateMatMulTestNetwork() { - ngraph::helpers::InputLayerType secondaryInputType = ngraph::helpers::InputLayerType::CONSTANT; auto netPrecision = InferenceEngine::Precision::FP32; std::map additionalConfig; auto ngPrc = InferenceEngine::details::convertPrecision(netPrecision); auto params = ngraph::builder::makeParams(ngPrc, {{3, 2, 10, 10}}); - auto secondaryInput = ngraph::builder::makeInputLayer(ngPrc, secondaryInputType, {3, 2, 10, 20}); + auto secondaryInput = std::make_shared(ngPrc, ov::Shape{3, 2, 10, 20}); auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); auto MatMul = std::dynamic_pointer_cast( @@ -63,14 +62,13 @@ class SuperDummyOp : public ov::op::Op { }; inline std::shared_ptr CreateSuperOperationTestNetwork() { - ngraph::helpers::InputLayerType secondaryInputType = ngraph::helpers::InputLayerType::CONSTANT; auto netPrecision = InferenceEngine::Precision::FP32; std::map additionalConfig; auto ngPrc = InferenceEngine::details::convertPrecision(netPrecision); auto params = ngraph::builder::makeParams(ngPrc, {{3, 2, 10, 10}}); - auto secondaryInput = ngraph::builder::makeInputLayer(ngPrc, secondaryInputType, {3, 2, 10, 20}); + auto secondaryInput = std::make_shared(ngPrc, ov::Shape{3, 2, 10, 20}); auto paramOuts = ngraph::helpers::convert2OutputVector(ngraph::helpers::castOps2Nodes(params)); auto superOp = std::make_shared(paramOuts[0], secondaryInput);