From c16b4dea350545122b341ab417a087e6392fe8e2 Mon Sep 17 00:00:00 2001 From: Ekaterina Shiryaeva Date: Mon, 16 Dec 2024 13:13:18 +0000 Subject: [PATCH] Move filter_by_ranges to unnamed namespace --- src/cpp/src/whisper/whisper_utils.cpp | 29 ++++++++++++++------------- src/cpp/src/whisper/whisper_utils.hpp | 5 ----- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/cpp/src/whisper/whisper_utils.cpp b/src/cpp/src/whisper/whisper_utils.cpp index 3c096cb461..2cc3cbe6cc 100644 --- a/src/cpp/src/whisper/whisper_utils.cpp +++ b/src/cpp/src/whisper/whisper_utils.cpp @@ -3,10 +3,23 @@ #include "whisper_utils.hpp" -namespace ov { +namespace { -namespace genai { +template +void filter_by_ranges(std::vector& value, size_t offset, std::vector>& ranges) { + OPENVINO_ASSERT(ranges.empty() || value.size() >= (offset + ranges.back().second)); + std::vector result{value.begin(), value.begin() + offset}; + for (auto [start, end] : ranges) { + result.insert(result.end(), value.begin() + offset + start, value.begin() + offset + end); + } + value = result; +} + +} // namespace + +namespace ov { +namespace genai { namespace utils { void infer_with_perf_metrics(ov::InferRequest& request, ov::genai::RawPerfMetrics& raw_metrics) { @@ -20,18 +33,6 @@ void infer_with_perf_metrics(ov::InferRequest& request, ov::genai::RawPerfMetric raw_metrics.m_batch_sizes.emplace_back(1); } - -template -void filter_by_ranges(std::vector& value, size_t offset, std::vector>& ranges) { - OPENVINO_ASSERT(ranges.empty() || value.size() >= (offset + ranges.back().second)); - std::vector result{value.begin(), value.begin() + offset}; - for (auto [start, end] : ranges) { - result.insert(result.end(), value.begin() + offset + start, value.begin() + offset + end); - } - - value = result; -} - void filter_non_segment_metrics(ov::genai::RawPerfMetrics& raw_metrics, size_t offset, std::vector>& ranges) { diff --git a/src/cpp/src/whisper/whisper_utils.hpp b/src/cpp/src/whisper/whisper_utils.hpp index 1880cfc3a4..2bf5dd037c 100644 --- a/src/cpp/src/whisper/whisper_utils.hpp +++ b/src/cpp/src/whisper/whisper_utils.hpp @@ -8,16 +8,11 @@ #include "openvino/genai/perf_metrics.hpp" namespace ov { - namespace genai { - namespace utils { void infer_with_perf_metrics(ov::InferRequest& request, ov::genai::RawPerfMetrics& raw_metrics); -template -void filter_by_ranges(std::vector& value, size_t offset, std::vector>& ranges); - void filter_non_segment_metrics(ov::genai::RawPerfMetrics& raw_metrics, size_t offset, std::vector>& ranges);