@@ -106,34 +106,32 @@ struct resample_impl : public typed_primitive_impl<resample> {
106
106
auto input_mem_ptr = instance.input_memory_ptr ();
107
107
cldnn::mem_lock<uint8_t , mem_lock_type::read > input_lock (input_mem_ptr, stream);
108
108
109
+ auto input_rank = params->input_layouts [0 ].get_rank ();
109
110
for (size_t i = 0 ; i < params->input_layouts .size (); i++) {
110
111
auto input_tensor = make_tensor (params->input_layouts [0 ], input_lock.data ());
111
112
input_host_tensors.push_back (input_tensor);
112
113
}
113
114
115
+ if (scales.size () < input_rank)
116
+ scales.insert (scales.begin (), input_rank - scales.size (), 1 .f );
117
+
118
+ for (size_t i = (input_rank - axes.size ()); i > 0 ; i--)
119
+ axes.insert (axes.begin (), 1 , (i - 1 ));
120
+
114
121
if (input_host_tensors.size () == 1 ) {
115
122
auto target_shape_sizes = params->output_layouts [0 ].get_tensor ().sizes ();
116
123
std::vector<int64_t > target_shape_ps;
117
- for (size_t i = 0 ; i < axes. size () ; i++)
124
+ for (size_t i = 0 ; i < input_rank ; i++)
118
125
target_shape_ps.push_back (target_shape_sizes[i]);
119
126
120
127
auto target_shape_tensor = ov::Tensor (ov::element::i32, {target_shape_ps.size ()}, target_shape_ps.data ());
121
128
input_host_tensors.push_back (target_shape_tensor);
122
129
123
- if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SIZES) {
124
- auto new_scales = scales;
125
- auto input_shape_sizes = params->input_layouts [0 ].get_tensor ().sizes ();
126
- for (size_t i = 0 ; i < sizes.size (); i++)
127
- new_scales[i] = sizes[i] / input_shape_sizes[i];
128
-
129
- auto scales_tensor = ov::Tensor (ov::element::f32, {new_scales.size ()}, new_scales.data ());
130
- input_host_tensors.push_back (scales_tensor);
131
- shape_calc_mode = ov::op::util::InterpolateBase::ShapeCalcMode::SCALES;
132
- } else if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) {
130
+ if (shape_calc_mode == ov::op::util::InterpolateBase::ShapeCalcMode::SCALES) {
133
131
auto scales_tensor = ov::Tensor (ov::element::f32, {scales.size ()}, scales.data ());
134
132
input_host_tensors.push_back (scales_tensor);
135
133
} else {
136
- OPENVINO_ASSERT (false , " [GPU] Not supported Interpolate ShapeCalcMode" , instance.id ());
134
+ OPENVINO_ASSERT (false , " [GPU] Not supported Interpolate ShapeCalcMode of CPU impl " , instance.id ());
137
135
}
138
136
139
137
auto axes_tensor = ov::Tensor (ov::element::i64, {axes.size ()}, axes.data ());
@@ -189,19 +187,6 @@ struct resample_impl : public typed_primitive_impl<resample> {
189
187
namespace detail {
190
188
191
189
attach_resample_impl::attach_resample_impl () {
192
- // auto formats = {
193
- // format::bfyx,
194
- // };
195
-
196
- // auto types = {
197
- // data_types::f32,
198
- // };
199
-
200
- // implementation_map<resample>::add(impl_types::cpu, shape_types::static_shape, resample_impl::create, types, formats);
201
- // implementation_map<resample>::add(impl_types::cpu, shape_types::dynamic_shape, resample_impl::create, types, formats);
202
-
203
- // std::set<implementation_map<resample>::key_type> keys;
204
-
205
190
const auto types = {data_types::f32, data_types::i32};
206
191
const auto formats = {
207
192
format::bfyx,
@@ -219,13 +204,6 @@ attach_resample_impl::attach_resample_impl() {
219
204
format::bs_fs_zyx_bsv32_fsv32,
220
205
format::bs_fs_zyx_bsv32_fsv16,
221
206
};
222
- // for (const auto type : types) {
223
- // for (const auto format : formats) {
224
- // keys.emplace(type, format);
225
- // }
226
- // }
227
-
228
- // keys.emplace(data_types::f32, format::yxfb);
229
207
230
208
implementation_map<resample>::add (impl_types::cpu, shape_types::static_shape, resample_impl::create, types, formats);
231
209
implementation_map<resample>::add (impl_types::cpu, shape_types::dynamic_shape, resample_impl::create, types, formats);
0 commit comments