OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] Init tensor.data when allocating inputs for string type (#27269)
David Nama7ff891fa552
diff --git a/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp b/src/plugins/intel_gpu/src/plugin/sync_infer_request.cppindex 26771117e2e..985336b801b 100644--- a/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp+++ b/src/plugins/intel_gpu/src/plugin/sync_infer_request.cpp@@ -592,6 +592,12 @@ void SyncInferRequest::allocate_input(const ov::Output<const ov::Node>& port, siauto element_type = port.get_element_type();m_user_inputs[input_idx] = { create_host_tensor(shape, element_type), TensorOwner::PLUGIN };+ 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.+ auto data = m_user_inputs.at(input_idx).ptr->data<std::string>();+ 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);}diff --git a/tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.py b/tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.pyindex e0050c245f1..4cd5b05f3e8 100644--- a/tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.py+++ b/tests/layer_tests/tensorflow_tests/test_tf_LookupTableSize.py@@ -69,8 +69,6 @@ class TestLookupTableSizeOps(CommonTFLayerTest):def test_lookup_table_size(self, hash_table_type, params, ie_device, precision, ir_version, temp_dir,use_legacy_frontend):keys_type = params['keys_type']- if ie_device == 'GPU' and keys_type == str:- pytest.skip("148921: Segmentation fault on GPU")self._test(*self.create_lookup_table_size_net(hash_table_type=hash_table_type, **params),ie_device, precision, ir_version, temp_dir=temp_dir,use_legacy_frontend=use_legacy_frontend)