Skip to content

Commit

Permalink
[GPU] fix onednn deconvolution
Browse files Browse the repository at this point in the history
  • Loading branch information
p-durandin committed Nov 29, 2024
1 parent 7e42cb2 commit 3816fb7
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ static std::shared_ptr<dnnl::deconvolution_forward::primitive_desc> get_deconvol
auto output_md = onednn::layout_to_memory_desc(output_layout, tag_in_out);
auto grouped_weights = format::is_grouped(weights_layout.format) || prim->grouped_weights_shape;

// Extend deconv parameters in case if spatials rank of output memory doesn't match size of parameters
int64_t insert_count = static_cast<int64_t>(output_md.get_dims().size()) - 2 - stride.size();
if (insert_count > 0) {
stride.insert(stride.end(), insert_count, 1);
pad_l.insert(pad_l.end(), insert_count, 0);
pad_r.insert(pad_r.end(), insert_count, 0);
}

for (size_t i = 0; i < dilation.size(); i++) {
dilation[i]--;
int weights_offset = (grouped_weights ? 3 : 2) + static_cast<int>(i);
Expand All @@ -45,14 +53,6 @@ static std::shared_ptr<dnnl::deconvolution_forward::primitive_desc> get_deconvol
pad_r[i] = (is - 1) * stride[i] - os + kernel_range - pad_l[i];
}

// Extend deconv parameters in case if spatials rank of output memory doesn't match size of parameters
int64_t insert_count = static_cast<int64_t>(output_md.get_dims().size()) - 2 - stride.size();
if (insert_count > 0) {
stride.insert(stride.end(), insert_count, 1);
pad_l.insert(pad_l.end(), insert_count, 0);
pad_r.insert(pad_r.end(), insert_count, 0);
}

if (!prim->bias.empty()) {
auto bias_md = onednn::layout_to_memory_desc(impl_params.get_input_layout(2), dnnl::memory::format_tag::any, true);
return std::make_shared<dnnl::deconvolution_forward::primitive_desc>(
Expand Down

0 comments on commit 3816fb7

Please sign in to comment.