diff --git a/modules/custom_operations/user_ie_extensions/include/openvino_extensions/strings.hpp b/modules/custom_operations/user_ie_extensions/include/openvino_extensions/strings.hpp index 5bfe85e5a..c970d0db9 100644 --- a/modules/custom_operations/user_ie_extensions/include/openvino_extensions/strings.hpp +++ b/modules/custom_operations/user_ie_extensions/include/openvino_extensions/strings.hpp @@ -13,7 +13,7 @@ namespace openvino_extensions { // Tensor destination will be reshaped according the input data template void pack_strings(const BatchOfStrings& strings, ov::Tensor& destination) { - auto batch_size = strings.size(); + size_t batch_size = strings.size(); // First run over all elements: calculate total memory required to hold all strings size_t symbols_size = std::accumulate( @@ -25,7 +25,7 @@ void pack_strings(const BatchOfStrings& strings, ov::Tensor& destination) { destination.set_shape({total_size}); int32_t* pindices = reinterpret_cast(destination.data()); - pindices[0] = batch_size; + pindices[0] = int32_t(batch_size); pindices[1] = 0; pindices += 2; char* psymbols = reinterpret_cast(pindices + batch_size); @@ -34,25 +34,25 @@ void pack_strings(const BatchOfStrings& strings, ov::Tensor& destination) { for (const auto& str: strings) { psymbols = std::copy(str.begin(), str.end(), psymbols); current_symbols_pos += str.size(); - *pindices = current_symbols_pos; - ++pindices; + *pindices = int32_t(current_symbols_pos); + ++pindices; } } std::vector unpack_strings(const ov::Tensor& source) { - int32_t length = source.get_byte_size(); + size_t length = source.get_byte_size(); // check the format of the input bitstream representing the string tensor OPENVINO_ASSERT(length >= 4, "Incorrect packed string tensor format: no batch size in the packed string tensor"); const int32_t* pindices = reinterpret_cast(source.data()); int32_t batch_size = pindices[0]; - OPENVINO_ASSERT(length >= 4 + 4 + 4 * batch_size, + OPENVINO_ASSERT(int32_t(length) >= 4 + 4 + 4 * batch_size, "Incorrect packed string tensor format: the packed string tensor must contain first string offset and end indices"); const int32_t* begin_ids = pindices + 1; const int32_t* end_ids = pindices + 2; const char* symbols = reinterpret_cast(pindices + 2 + batch_size); std::vector result; - result.reserve(batch_size); + result.reserve(size_t(batch_size)); for (int32_t idx = 0; idx < batch_size; ++idx) { result.emplace_back(symbols + begin_ids[idx], symbols + end_ids[idx]); }