From 0f7e6de3461264f6e0a0161d9096a252b30a375e Mon Sep 17 00:00:00 2001 From: Mikhail Ryzhov Date: Thu, 20 Apr 2023 11:51:23 +0200 Subject: [PATCH] [GNA] WA to fix config parsing of scale factor map (#17060) * WA to fix config parsing * clang fix * excluded json --- samples/cpp/speech_sample/main.cpp | 2 +- samples/cpp/speech_sample/utils.hpp | 9 +++++++++ .../include/openvino/runtime/intel_gna/properties.hpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/samples/cpp/speech_sample/main.cpp b/samples/cpp/speech_sample/main.cpp index 3c17b8e3488..99eae40b88a 100644 --- a/samples/cpp/speech_sample/main.cpp +++ b/samples/cpp/speech_sample/main.cpp @@ -215,7 +215,7 @@ int main(int argc, char* argv[]) { numFrames * numFrameElements); slog::info << "Using scale factor of " << floatScaleFactor << " calculated from first utterance." << slog::endl; - scale_factors_per_input[model->input(i).get_any_name()] = floatScaleFactor; + scale_factors_per_input[strip_name(model->input(i).get_any_name())] = floatScaleFactor; } gnaPluginConfig[ov::intel_gna::scale_factors_per_input.name()] = scale_factors_per_input; } diff --git a/samples/cpp/speech_sample/utils.hpp b/samples/cpp/speech_sample/utils.hpp index e6ac786942b..9342036c6db 100644 --- a/samples/cpp/speech_sample/utils.hpp +++ b/samples/cpp/speech_sample/utils.hpp @@ -367,6 +367,15 @@ bool check_name(const ov::OutputVector& nodes, const std::string& node_name) { return count; } +/** + * @brief Strip the name of the input to exclude ":port" + * @param name input name + * @return striped input name + */ +std::string strip_name(const std::string& name) { + return {name, 0, name.rfind(':')}; +} + /** * @brief Parse scale factors per input * Format : =,= or just diff --git a/src/inference/include/openvino/runtime/intel_gna/properties.hpp b/src/inference/include/openvino/runtime/intel_gna/properties.hpp index a7dbd29a58e..4e53c05187c 100644 --- a/src/inference/include/openvino/runtime/intel_gna/properties.hpp +++ b/src/inference/include/openvino/runtime/intel_gna/properties.hpp @@ -37,7 +37,7 @@ static constexpr Property library_full_vers * This option should be used with floating point value serialized to string with . (dot) as a decimal separator * @ingroup ov_runtime_gna_prop_cpp_api * @details In the case of multiple inputs, individual scale factors can be provided using the - * map where key is layer name and value is scale factor + * map where key is layer name and value is scale factor. The input name shall not contain symbol ":". * Example: * \code{.cpp} * ov::Core core;