From fa99e514c91e9c791b29afef85dcfe101ef2675b Mon Sep 17 00:00:00 2001 From: rgarcia Date: Mon, 15 Jul 2024 16:41:15 +0200 Subject: [PATCH] Fix Transpose Convolutions --- src/descriptors/descriptor_convT2D.cpp | 5 +++-- src/serialization/onnx/net/layers/conv/convT_onnx.cpp | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/descriptors/descriptor_convT2D.cpp b/src/descriptors/descriptor_convT2D.cpp index 5408c5ee1..3c13c2212 100644 --- a/src/descriptors/descriptor_convT2D.cpp +++ b/src/descriptors/descriptor_convT2D.cpp @@ -79,7 +79,8 @@ void ConvolDescriptorT2D::build(Tensor *A) { I = A; - nk = A->shape[1]; //ksize[0]; + //nk = A->shape[1]; + nk = ksize[0]; kr = ksize[1]; kc = ksize[2]; kz = A->shape[1]/groups; @@ -213,7 +214,7 @@ void ConvolDescriptorT2D::build(Tensor *A) { in,iz,ir,ic); cudnnCreateFilterDescriptor(&wDesc); //CONVT we need to swap input channels with output so all other swappings (forward and backward functions) matches - cudnnSetFilter4dDescriptor(wDesc, data_type, tensor_format, nk, kz, kr, kc); + cudnnSetFilter4dDescriptor(wDesc, data_type, tensor_format, kz, nz, kr, kc); cudnnCreateTensorDescriptor(&yDesc); cudnnSetTensor4dDescriptor(yDesc, tensor_format, data_type, in, z,r,c); diff --git a/src/serialization/onnx/net/layers/conv/convT_onnx.cpp b/src/serialization/onnx/net/layers/conv/convT_onnx.cpp index c7199bd34..9f6497650 100644 --- a/src/serialization/onnx/net/layers/conv/convT_onnx.cpp +++ b/src/serialization/onnx/net/layers/conv/convT_onnx.cpp @@ -87,7 +87,8 @@ Layer* build_convT_layer(onnx::NodeProto *node, string weights_name = node->input(1); // Get weights and dims vector *weights = &(map_init_values[weights_name]); vector dims = map_init_dims[weights_name]; - filters = dims[0]; + //filters = dims[0]; + filters = dims[1]; // Deduce conv dimension from layer input if (parent_shape.size() == 3)