From 0f984ea0f06635f80ebfb3ed97fd895bc3e6b917 Mon Sep 17 00:00:00 2001 From: TolyaTalamanov Date: Tue, 11 Apr 2023 10:25:52 +0000 Subject: [PATCH] Handle const inputs descs in giebackend --- modules/gapi/src/backends/ie/giebackend.cpp | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/modules/gapi/src/backends/ie/giebackend.cpp b/modules/gapi/src/backends/ie/giebackend.cpp index c856b15c65..e64bb2f4b0 100644 --- a/modules/gapi/src/backends/ie/giebackend.cpp +++ b/modules/gapi/src/backends/ie/giebackend.cpp @@ -1384,6 +1384,11 @@ struct Infer: public cv::detail::KernelTag { } } + for (auto &&p : uu.params.const_inputs) { + const auto ii = inputs.at(p.first); + ii->setPrecision(toIE(p.second.first.depth())); + } + // FIXME: This isn't the best place to call reshape function. // Сorrect solution would be to do this in compile() method of network, // but now input meta isn't passed to compile() method. @@ -1506,6 +1511,12 @@ struct InferROI: public cv::detail::KernelTag { const_cast(uu.net_input_params) .set_param(input_name, ii->getTensorDesc()); } + + for (auto &&p : uu.params.const_inputs) { + const auto ii = inputs.at(p.first); + ii->setPrecision(toIE(p.second.first.depth())); + } + configureOutputPrecision(uu.net.getOutputsInfo(), uu.params.output_precision); } else { GAPI_Assert(uu.params.kind == cv::gapi::ie::detail::ParamDesc::Kind::Import); @@ -1624,6 +1635,12 @@ struct InferList: public cv::detail::KernelTag { if (!input_reshape_table.empty()) { const_cast(&uu.net)->reshape(input_reshape_table); } + + for (auto &&p : uu.params.const_inputs) { + const auto ii = inputs.at(p.first); + ii->setPrecision(toIE(p.second.first.depth())); + } + configureOutputPrecision(uu.net.getOutputsInfo(), uu.params.output_precision); } else { GAPI_Assert(uu.params.kind == cv::gapi::ie::detail::ParamDesc::Kind::Import); @@ -1772,6 +1789,11 @@ struct InferList2: public cv::detail::KernelTag { ii->getPreProcess().setResizeAlgorithm(IE::RESIZE_BILINEAR); } + for (auto &&p : uu.params.const_inputs) { + const auto ii = inputs.at(p.first); + ii->setPrecision(toIE(p.second.first.depth())); + } + // FIXME: This isn't the best place to call reshape function. // Сorrect solution would be to do this in compile() method of network, // but now input meta isn't passed to compile() method.