diff --git a/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp b/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp index 58aa959aabf850..f9bf50aa4be73e 100644 --- a/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/cpu/resample.cpp @@ -106,34 +106,32 @@ struct resample_impl : public typed_primitive_impl { auto input_mem_ptr = instance.input_memory_ptr(); cldnn::mem_lock input_lock(input_mem_ptr, stream); + auto input_rank = params->input_layouts[0].get_rank(); for (size_t i = 0; i < params->input_layouts.size(); i++) { auto input_tensor = make_tensor(params->input_layouts[0], input_lock.data()); input_host_tensors.push_back(input_tensor); } + if (scales.size() < input_rank) + scales.insert(scales.begin(), input_rank - scales.size(), 1.f); + + for(size_t i = (input_rank - axes.size()); i > 0; i--) + axes.insert(axes.begin(), 1, (i - 1)); + if (input_host_tensors.size() == 1) { auto target_shape_sizes = params->output_layouts[0].get_tensor().sizes(); std::vector target_shape_ps; - for (size_t i = 0; i < axes.size(); i++) + for (size_t i = 0; i < input_rank; i++) target_shape_ps.push_back(target_shape_sizes[i]); auto target_shape_tensor = ov::Tensor(ov::element::i32, {target_shape_ps.size()}, target_shape_ps.data()); input_host_tensors.push_back(target_shape_tensor); - if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SIZES) { - auto new_scales = scales; - auto input_shape_sizes = params->input_layouts[0].get_tensor().sizes(); - for (size_t i = 0; i < sizes.size(); i++) - new_scales[i] = sizes[i] / input_shape_sizes[i]; - - auto scales_tensor = ov::Tensor(ov::element::f32, {new_scales.size()}, new_scales.data()); - input_host_tensors.push_back(scales_tensor); - shape_calc_mode = ov::op::util::InterpolateBase::ShapeCalcMode::SCALES; - } else if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { + if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { auto scales_tensor = ov::Tensor(ov::element::f32, {scales.size()}, scales.data()); input_host_tensors.push_back(scales_tensor); } else { - OPENVINO_ASSERT(false, "[GPU] Not supported Interpolate ShapeCalcMode", instance.id()); + OPENVINO_ASSERT(false, "[GPU] Not supported Interpolate ShapeCalcMode of CPU impl", instance.id()); } auto axes_tensor = ov::Tensor(ov::element::i64, {axes.size()}, axes.data()); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp index 2ca31874469707..a480617c1b690e 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.cpp @@ -175,42 +175,6 @@ struct resample_impl : typed_primitive_impl_ocl { } }; -// namespace detail { - -// attach_resample_impl::attach_resample_impl() { -// std::set::key_type> keys; - -// const auto types = {data_types::f16, data_types::f32, data_types::i8, data_types::u8, data_types::i32}; -// const auto formats = { -// format::bfyx, -// format::b_fs_yx_fsv16, -// format::b_fs_yx_fsv32, -// format::bs_fs_yx_bsv16_fsv16, -// format::bs_fs_yx_bsv32_fsv16, -// format::bs_fs_yx_bsv32_fsv32, - -// format::bfzyx, -// format::b_fs_zyx_fsv16, -// format::b_fs_zyx_fsv32, -// format::bs_fs_zyx_bsv16_fsv32, -// format::bs_fs_zyx_bsv16_fsv16, -// format::bs_fs_zyx_bsv32_fsv32, -// format::bs_fs_zyx_bsv32_fsv16, -// }; -// for (const auto type : types) { -// for (const auto format : formats) { -// keys.emplace(type, format); -// } -// } - -// keys.emplace(data_types::f32, format::yxfb); -// keys.emplace(data_types::f16, format::yxfb); -// keys.emplace(data_types::f16, format::fs_b_yx_fsv32); - -// implementation_map::add(impl_types::ocl, typed_primitive_impl_ocl::create, keys); -// } - -// } // namespace detail std::unique_ptr ResampleImplementationManager::create_impl(const program_node& node, const kernel_impl_params& params) const { assert(node.is_type()); return typed_primitive_impl_ocl::create(static_cast(node), params); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp index f0a75a06b448b6..d31c08e777626b 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/resample.hpp @@ -5,6 +5,7 @@ #include "impls/registry/implementation_manager.hpp" #include "program_node.h" //#include "intel_gpu/primitives/resample.hpp" +#include "resample_inst.h" #include namespace cldnn { @@ -15,16 +16,6 @@ struct ResampleImplementationManager : public ImplementationManager { ResampleImplementationManager(shape_types shape_type, ValidateFunc vf = nullptr) : ImplementationManager(impl_types::ocl, shape_type, vf) {} std::unique_ptr create_impl(const program_node& node, const kernel_impl_params& params) const override; bool validate_impl(const program_node& node) const override { - // auto prim = node.as().get_primitive(); - // const auto& in0_layout = node.get_input_layout(0); - - // if (in0_layout.data_type == ov::element::f32 && - // prim->operation_type == ov::op::util::InterpolateBase::InterpolateMode::LINEAR_ONNX && - // prim->coord_trans_mode == ov::op::util::InterpolateBase::CoordinateTransformMode::ALIGN_CORNERS && - // prim->shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) { - // return false; - // } - return true; } }; diff --git a/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp b/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp index 737fd636d82a90..a2f8f54d4dedc9 100644 --- a/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/registry/resample_impls.cpp @@ -33,19 +33,10 @@ const std::vector>& Registry shapeParams4D_LargeShape = { ShapeParams{ ov::op::v4::Interpolate::ShapeCalcMode::SCALES, - //InputShape{{-1, {2, 100}, -1, -1}, {{1, 64, 148, 148}}}, - InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}}, // min shape for failure + InputShape{{-1, {2, 100}, -1, -1}, {{1, 64, 148, 148}}}, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT, {{1.f, 1.f, 2.f, 2.f}}, defaultAxes4D.front() }, + ShapeParams{ + ov::op::v4::Interpolate::ShapeCalcMode::SCALES, + InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}}, + ov::test::utils::InputLayerType::CONSTANT, + ov::test::utils::InputLayerType::CONSTANT, + {{2.f, 2.f}}, + reducedAxes4D.front() + }, ShapeParams{ ov::op::v4::Interpolate::ShapeCalcMode::SIZES, InputShape{{-1, -1, -1, -1}, {{1, 3, 48, 48}}},