diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp index 9d741e6c177393..362aa651f8c251 100644 --- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp +++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp @@ -425,13 +425,23 @@ void primitive_inst::update_shape() { _impl_params->memory_deps = memory_deps; + auto new_layouts = _node->type()->calc_output_layouts(*_node, *_impl_params); - for (size_t i = 0; i != _impl_params->output_layouts.size(); ++i) { - set_shape_change(); - _impl_params->output_layouts[i].set_partial_shape(new_layouts[i].get_partial_shape()); + for (size_t idx = 0; idx != new_layouts.size(); ++idx) { + auto& new_layout = new_layouts[idx]; if (!_node->is_type() || (!_node->get_input_layout(0).has_dynamic_pad() && !_node->can_be_optimized())) { - _impl_params->output_layouts[i].data_padding = padding::max(_impl_params->output_layouts[i].data_padding, new_layouts[i].data_padding); + auto data_padding = padding::max(_impl_params->get_output_layout(idx).data_padding, new_layout.data_padding); + new_layout.data_padding = padding::max(_node->get_primitive()->get_output_padding(idx), data_padding); + } + + if (_impl_params->get_output_layout(idx) != new_layout) { + GPU_DEBUG_TRACE_DETAIL << id() << ": update shape: was: " << _impl_params->get_output_layout(idx).to_short_string() + << " now: " << new_layout.to_short_string() << std::endl; + set_shape_change(); } + + _impl_params->output_layouts[idx].data_padding = new_layout.data_padding; + _impl_params->output_layouts[idx].set_partial_shape(new_layouts[idx].get_partial_shape()); } // Update descriptors of fused operations and set output_layout's shape to all fused ops