diff --git a/src/plugins/intel_gpu/src/graph/condition.cpp b/src/plugins/intel_gpu/src/graph/condition.cpp index 6c1262e00bc023..a12d63b38015ba 100644 --- a/src/plugins/intel_gpu/src/graph/condition.cpp +++ b/src/plugins/intel_gpu/src/graph/condition.cpp @@ -263,7 +263,8 @@ void condition_inst::postprocess_output_memory(network::ptr executed_net, cldnn: } _outputs[out_mem_idx] = mem_ptr; - GPU_DEBUG_LOG << "Inner net - Outputs[" << out_mem_idx << "]" << mem_ptr->get_layout().to_short_string() << std::endl; + if (mem_ptr) + GPU_DEBUG_LOG << "Inner net - Outputs[" << out_mem_idx << "]" << mem_ptr->get_layout().to_short_string() << std::endl; } } } // namespace cldnn diff --git a/src/plugins/intel_gpu/src/plugin/ops/strided_slice.cpp b/src/plugins/intel_gpu/src/plugin/ops/strided_slice.cpp index e24d27aa4b8e50..ae2da9cad79a41 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/strided_slice.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/strided_slice.cpp @@ -53,7 +53,7 @@ static void CreateStridedSliceOp(ProgramBuilder& p, const std::shared_ptr strides = stride_constant ? stride_constant->cast_vector() : std::vector{}; do { - if (!begin_constant || !end_constant || !stride_constant || input_pshape.is_dynamic()) { + if (!begin_constant || !end_constant || !stride_constant || input_pshape.is_dynamic() || p.use_new_shape_infer()) { break; } @@ -265,7 +265,7 @@ static void CreateStridedSliceOp(ProgramBuilder& p, const std::shared_ptr stridedSlicePrim = nullptr; - if (begin_constant && end_constant && stride_constant && !input_pshape.is_dynamic() && !output_pshape.is_dynamic()) { + if (begin_constant && end_constant && stride_constant && !input_pshape.is_dynamic() && !output_pshape.is_dynamic() && !p.use_new_shape_infer()) { stridedSlicePrim = std::make_shared(layerName, inputs[0], begin, diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp index 954db256c9aad8..0854eaa6a8327a 100644 --- a/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp +++ b/src/plugins/intel_gpu/tests/functional/single_layer_tests/dynamic/strided_slice.cpp @@ -179,10 +179,144 @@ class StridedSliceLayerGPUTest : public testing::WithParamInterface& targetInputStaticShapes) override { + inputs.clear(); + const auto& funcInputs = function->inputs(); + ov::Tensor tensor; + + // input0: data + int32_t idx = 0; + tensor = ov::test::utils::create_and_fill_tensor(funcInputs[idx].get_element_type(), targetInputStaticShapes[idx]); + inputs.insert({funcInputs[idx].get_node_shared_ptr(), tensor}); + + // input1: begin + if (rest_input_type[0] == ov::test::utils::InputLayerType::PARAMETER) { + idx += 1; + tensor = ov::Tensor(funcInputs[idx].get_element_type(), targetInputStaticShapes[idx]); + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < begin.size(); i++) { + dataPtr[i] = static_cast(begin[i]); + } + inputs.insert({funcInputs[idx].get_node_shared_ptr(), tensor}); + } + + // input2: end + if (rest_input_type[1] == ov::test::utils::InputLayerType::PARAMETER) { + idx += 1; + tensor = ov::Tensor(funcInputs[idx].get_element_type(), targetInputStaticShapes[idx]); + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < end.size(); i++) { + dataPtr[i] = static_cast(end[i]); + } + inputs.insert({funcInputs[idx].get_node_shared_ptr(), tensor}); + } + + // input3: stride + if (rest_input_type[2] == ov::test::utils::InputLayerType::PARAMETER) { + idx += 1; + tensor = ov::Tensor(funcInputs[idx].get_element_type(), targetInputStaticShapes[idx]); + auto *dataPtr = tensor.data(); + for (size_t i = 0; i < stride.size(); i++) { + dataPtr[i] = static_cast(stride[i]); + } + inputs.insert({funcInputs[idx].get_node_shared_ptr(), tensor}); + } + + // data for input_1d + idx += 1; + tensor = ov::test::utils::create_and_fill_tensor(funcInputs[idx].get_element_type(), targetInputStaticShapes[idx]); + inputs.insert({funcInputs[idx].get_node_shared_ptr(), tensor}); + + inferRequestNum++; + } + +protected: + std::vector begin; + std::vector end; + std::vector stride; + std::vector rest_input_type; + size_t inferRequestNum = 0; + + void SetUp() override { + InputShape shapes; + StridedSliceParams ssParams; + std::tie(shapes, ssParams, inType, rest_input_type) = this->GetParam(); + + begin = ssParams.begin; + end = ssParams.end; + stride = ssParams.stride; + + targetDevice = ov::test::utils::DEVICE_GPU; + + std::vector inputShapes; + + ov::PartialShape input_1d_shape{1024}; + + inputShapes.push_back(shapes); + if (rest_input_type[0] == ov::test::utils::InputLayerType::PARAMETER) + inputShapes.push_back(InputShape({static_cast(begin.size())}, std::vector(shapes.second.size(), {begin.size()}))); + if (rest_input_type[1] == ov::test::utils::InputLayerType::PARAMETER) + inputShapes.push_back(InputShape({static_cast(end.size())}, std::vector(shapes.second.size(), {end.size()}))); + if (rest_input_type[2] == ov::test::utils::InputLayerType::PARAMETER) + inputShapes.push_back(InputShape({static_cast(stride.size())}, std::vector(shapes.second.size(), {stride.size()}))); + + inputShapes.push_back(InputShape(input_1d_shape, {input_1d_shape.to_shape()})); + + init_input_shapes(inputShapes); + + ov::ParameterVector params{std::make_shared(inType, inputDynamicShapes.front())}; + + std::shared_ptr beginInput, endInput, strideInput; + if (rest_input_type[0] == ov::test::utils::InputLayerType::PARAMETER) { + auto beginNode = std::make_shared(ov::element::i64, ov::Shape{begin.size()}); + params.push_back(beginNode); + beginInput = beginNode; + } else { + beginInput = std::make_shared(ov::element::i64, ov::Shape{begin.size()}, begin); + } + + if (rest_input_type[1] == ov::test::utils::InputLayerType::PARAMETER) { + auto endNode = std::make_shared(ov::element::i64, ov::Shape{end.size()}); + params.push_back(endNode); + endInput = endNode; + } else { + endInput = std::make_shared(ov::element::i64, ov::Shape{end.size()}, end); + } + + if (rest_input_type[2] == ov::test::utils::InputLayerType::PARAMETER) { + auto strideNode = std::make_shared(ov::element::i64, ov::Shape{stride.size()}); + params.push_back(strideNode); + strideInput = strideNode; + } else { + strideInput = std::make_shared(ov::element::i64, ov::Shape{stride.size()}, stride); + } + + auto input_1d = std::make_shared(inType, input_1d_shape.to_shape()); + params.push_back(input_1d); + + auto ss = std::make_shared(input_1d, beginInput, endInput, strideInput, ssParams.beginMask, ssParams.endMask, + ssParams.newAxisMask, ssParams.shrinkAxisMask, ssParams.ellipsisAxisMask); + auto mul = std::make_shared(params[0], ss); + + ov::ResultVector results; + for (size_t i = 0; i < mul->get_output_size(); i++) { + results.push_back(std::make_shared(mul->output(i))); + } + + function = std::make_shared(results, params, "StridedSlice"); + } +}; + TEST_P(StridedSliceLayerGPUTest, Inference) { run(); } +TEST_P(StridedSliceLayerReshapeGPUTest, Inference) { + run(); +} + const std::vector model_types = { ov::element::f32 }; @@ -305,3 +439,19 @@ INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Common_Dynamic_6D, StridedSliceLa ::testing::ValuesIn(rest_input_types)), StridedSliceLayerGPUTest::getTestCaseName); } // namespace + +const std::vector inputShapesDynamic3D = { + {{-1, -1, -1}, + {{ 1, 1024, 2 }}}, +}; +const std::vector paramsPlain3D = { + StridedSliceParams{ { 0, 0, 0 }, { 0, 0, 0 }, { 1, 1, 1 }, { 0, 1, 0 }, { 0, 1, 0 }, { 1, 0, 1 }, { }, { } }, +}; + +INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_new_axis_3D, StridedSliceLayerReshapeGPUTest, + ::testing::Combine( + ::testing::ValuesIn(inputShapesDynamic3D), + ::testing::ValuesIn(paramsPlain3D), + ::testing::ValuesIn(model_types), + ::testing::Values(rest_input_types[0])), + StridedSliceLayerGPUTest::getTestCaseName); \ No newline at end of file