@@ -2373,3 +2373,48 @@ TEST(gather_gpu_fp32, dynamic_support_neg_ind) {
2373
2373
ASSERT_EQ (expected_results[i], output_ptr[i]) << i;
2374
2374
}
2375
2375
}
2376
+
2377
+ TEST (gather_gpu_fp32, dynamic_support_scalar_indice_empty_memory) {
2378
+ auto & engine = get_test_engine ();
2379
+
2380
+ ov::Shape data_shape = { 3 , 3 };
2381
+ int64_t axis = 1 ;
2382
+
2383
+ auto data_layout = layout{ov::PartialShape::dynamic (data_shape.size ()), data_types::f32, format::bfyx};
2384
+ auto indices_layout = layout{ov::PartialShape ({1 }), data_types::i32, format::bfyx};
2385
+
2386
+ auto data_mem = engine.allocate_memory (layout{ov::PartialShape (data_shape), data_types::f32, format::bfyx});
2387
+ auto indices_mem = engine.allocate_memory (layout{ov::PartialShape ({}), data_types::i32, format::bfyx});
2388
+
2389
+ set_values (data_mem, { 0 .f , 1 .f , 2 .f , 3 .f , 4 .f , 5 .f , 6 .f , 7 .f , 8 .f });
2390
+ set_values (indices_mem, { -1 });
2391
+
2392
+ topology topology;
2393
+ topology.add (input_layout (" data" , data_layout));
2394
+ topology.add (input_layout (" indices" , indices_layout));
2395
+ topology.add (gather (" gather" , input_info (" data" ), input_info (" indices" ), axis, data_shape.size (), ov::Shape{}, 0 , true ));
2396
+
2397
+ ExecutionConfig config = get_test_default_config (engine);
2398
+ config.set_property (ov::intel_gpu::allow_new_shape_infer (true ));
2399
+ network network (engine, topology, config);
2400
+
2401
+ network.set_input_data (" data" , data_mem);
2402
+ network.set_input_data (" indices" , indices_mem);
2403
+
2404
+ auto inst = network.get_primitive (" gather" );
2405
+ auto impl = inst->get_impl ();
2406
+ ASSERT_TRUE (impl != nullptr );
2407
+ ASSERT_TRUE (impl->is_dynamic ());
2408
+
2409
+ auto outputs = network.execute ();
2410
+
2411
+ auto output = outputs.at (" gather" ).get_memory ();
2412
+ cldnn::mem_lock<float > output_ptr (output, get_test_stream ());
2413
+
2414
+ std::vector<float > expected_results = { 2 .f , 5 .f , 8 .f };
2415
+
2416
+ ASSERT_EQ (expected_results.size (), output_ptr.size ());
2417
+ for (size_t i = 0 ; i < expected_results.size (); ++i) {
2418
+ ASSERT_EQ (expected_results[i], output_ptr[i]) << i;
2419
+ }
2420
+ }
0 commit comments