From d3b882ffab805a60abfa27dadf5cccc876fcd7aa Mon Sep 17 00:00:00 2001 From: "Nam, David" Date: Thu, 31 Oct 2024 00:11:44 +0900 Subject: [PATCH] Change method to initialize input data --- src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp b/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp index 096f27ad272527..985336b801b9d3 100644 --- a/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp +++ b/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp @@ -595,10 +595,8 @@ void SyncInferRequest::allocate_input(const ov::Output& port, si if (element_type == ov::element::string) { // In case the element type is string and input data is an empty string, // it produces the segmentation fault unless the each element of tensor.data is initialized. - std::string* data = m_user_inputs.at(input_idx).ptr->data(); - for (size_t i = 0; i < m_user_inputs.at(input_idx).ptr->get_size(); ++i) { - data->get_allocator().construct(data + i, std::string()); - } + auto data = m_user_inputs.at(input_idx).ptr->data(); + std::uninitialized_fill_n(data, m_user_inputs.at(input_idx).ptr->get_size(), std::string()); } ov::ISyncInferRequest::set_tensor(port, m_user_inputs.at(input_idx).ptr); }