@@ -199,10 +199,21 @@ kernel_impl_params primitive_impl::static_canonicalize_shapes(const kernel_impl_
199
199
200
200
uint32_t primitive_inst::get_network_id () const { return _network.get_id (); }
201
201
202
- void primitive_inst::check_memory_to_set (const memory& mem, const layout& layout) const {
203
- OPENVINO_ASSERT ((mem.get_layout () == layout) || layout.is_dynamic (), " [GPU] Unexpected layout of input memory for " , id (), " node!\n " ,
204
- " Node layout: " , layout.to_short_string (), " \n " ,
205
- " Memory layout: " , mem.get_layout ().to_short_string ());
202
+ void primitive_inst::check_memory_to_set (const memory& mem, const layout& l) const {
203
+ // The layout with empty tensor (scalar) is regarded as 1 dimension with value 1
204
+ bool single_value_layout = false ;
205
+ if (!l.is_dynamic ()) {
206
+ auto layout_ps = l.get_partial_shape ();
207
+ single_value_layout = (layout_ps.size () == 1 && layout_ps[0 ] == 1 );
208
+ }
209
+
210
+ auto mem_layout = mem.get_layout ();
211
+ OPENVINO_ASSERT ((mem_layout == l)
212
+ || l.is_dynamic ()
213
+ || (mem_layout.get_partial_shape ().size () == 0 && single_value_layout),
214
+ " [GPU] Unexpected layout of input memory for " , id (), " node!\n " ,
215
+ " Node layout: " , l.to_short_string (), " \n " ,
216
+ " Memory layout: " , mem_layout.to_short_string ());
206
217
207
218
// check shared image/buffer compatibility, if applicable
208
219
auto params = mem.get_internal_params ();
@@ -218,11 +229,11 @@ void primitive_inst::check_memory_to_set(const memory& mem, const layout& layout
218
229
switch (params.mem_type ) {
219
230
case shared_mem_type::shared_mem_vasurface:
220
231
case shared_mem_type::shared_mem_image:
221
- OPENVINO_ASSERT (layout .format .is_image_2d (), " Attempt to set user-supplied input or output image instead of a buffer" );
232
+ OPENVINO_ASSERT (l .format .is_image_2d (), " Attempt to set user-supplied input or output image instead of a buffer" );
222
233
break ;
223
234
case shared_mem_type::shared_mem_buffer:
224
235
case shared_mem_type::shared_mem_dxbuffer:
225
- OPENVINO_ASSERT (!layout .format .is_image_2d (), " Attempt to set user-supplied input or output buffer instead of an image" );
236
+ OPENVINO_ASSERT (!l .format .is_image_2d (), " Attempt to set user-supplied input or output buffer instead of an image" );
226
237
break ;
227
238
case shared_mem_type::shared_mem_usm:
228
239
break ;
0 commit comments