@@ -199,10 +199,20 @@ 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_dims = l.get_dims ();
207
+ single_value_layout = (layout_dims.size () == 1 && layout_dims[0 ] == 1 );
208
+ }
209
+
210
+ auto mem_layout = mem.get_layout ();
211
+ if ( !(mem_layout.get_tensor () == tensor ({}) && single_value_layout) ) {
212
+ OPENVINO_ASSERT ((mem_layout == l) || l.is_dynamic (), " [GPU] Unexpected layout of input memory for " , id (), " node!\n " ,
213
+ " Node layout: " , l.to_short_string (), " \n " ,
214
+ " Memory layout: " , mem_layout.to_short_string ());
215
+ }
206
216
207
217
// check shared image/buffer compatibility, if applicable
208
218
auto params = mem.get_internal_params ();
@@ -218,11 +228,11 @@ void primitive_inst::check_memory_to_set(const memory& mem, const layout& layout
218
228
switch (params.mem_type ) {
219
229
case shared_mem_type::shared_mem_vasurface:
220
230
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" );
231
+ OPENVINO_ASSERT (l .format .is_image_2d (), " Attempt to set user-supplied input or output image instead of a buffer" );
222
232
break ;
223
233
case shared_mem_type::shared_mem_buffer:
224
234
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" );
235
+ OPENVINO_ASSERT (!l .format .is_image_2d (), " Attempt to set user-supplied input or output buffer instead of an image" );
226
236
break ;
227
237
case shared_mem_type::shared_mem_usm:
228
238
break ;
0 commit comments