diff options
Diffstat (limited to 'src/routines/levelx')
-rw-r--r-- | src/routines/levelx/xcol2im.cpp | 0 | ||||
-rw-r--r-- | src/routines/levelx/xim2col.cpp | 16 | ||||
-rw-r--r-- | src/routines/levelx/xim2col.hpp | 1 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/routines/levelx/xcol2im.cpp b/src/routines/levelx/xcol2im.cpp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/routines/levelx/xcol2im.cpp diff --git a/src/routines/levelx/xim2col.cpp b/src/routines/levelx/xim2col.cpp index dfbb4bb5..09dcc42c 100644 --- a/src/routines/levelx/xim2col.cpp +++ b/src/routines/levelx/xim2col.cpp @@ -41,23 +41,23 @@ void Xim2col<T>::DoIm2col(const size_t channels, const size_t height, const size // Makes sure all dimensions are larger than zero if ((channels == 0) || (height == 0) || (width == 0)) { throw BLASError(StatusCode::kInvalidDimension); } - // Sets the output height and width + // Sets the height and width of the 'col' result const auto size_h = height + 2 * pad_h; const auto padding_h = dilation_h * (kernel_h - 1) + 1; - const auto output_h = (size_h >= padding_h) ? (size_h - padding_h) / stride_h + 1 : 1; + const auto col_h = (size_h >= padding_h) ? (size_h - padding_h) / stride_h + 1 : 1; const auto size_w = width + 2 * pad_w; const auto padding_w = dilation_w * (kernel_w - 1) + 1; - const auto output_w = (size_w >= padding_w) ? (size_w - padding_w) / stride_w + 1 : 1; + const auto col_w = (size_w >= padding_w) ? (size_w - padding_w) / stride_w + 1 : 1; - // Retrieves the Xcopy kernel from the compiled binary + // Retrieves the kernel from the compiled binary auto kernel = Kernel(program_, "im2col"); // Sets the kernel arguments kernel.SetArgument(0, static_cast<int>(height)); kernel.SetArgument(1, static_cast<int>(width)); kernel.SetArgument(2, static_cast<int>(channels)); - kernel.SetArgument(3, static_cast<int>(output_h)); - kernel.SetArgument(4, static_cast<int>(output_w)); + kernel.SetArgument(3, static_cast<int>(col_h)); + kernel.SetArgument(4, static_cast<int>(col_w)); kernel.SetArgument(5, static_cast<int>(kernel_h)); kernel.SetArgument(6, static_cast<int>(kernel_w)); kernel.SetArgument(7, static_cast<int>(pad_h)); @@ -72,8 +72,8 @@ void Xim2col<T>::DoIm2col(const size_t channels, const size_t height, const size kernel.SetArgument(16, static_cast<int>(col_offset)); // Launches the kernel - const auto w_ceiled = Ceil(output_w, db_["COPY_DIMX"]); - const auto h_ceiled = Ceil(output_h, db_["COPY_DIMY"]); + const auto w_ceiled = Ceil(col_w, db_["COPY_DIMX"]); + const auto h_ceiled = Ceil(col_h, db_["COPY_DIMY"]); const auto global = std::vector<size_t>{w_ceiled, h_ceiled * channels}; const auto local = std::vector<size_t>{db_["COPY_DIMX"], db_["COPY_DIMY"]}; RunKernel(kernel, queue_, device_, global, local, event_); diff --git a/src/routines/levelx/xim2col.hpp b/src/routines/levelx/xim2col.hpp index 4448b54e..2c03b169 100644 --- a/src/routines/levelx/xim2col.hpp +++ b/src/routines/levelx/xim2col.hpp @@ -8,6 +8,7 @@ // Cedric Nugteren <www.cedricnugteren.nl> // // This file implements the Xim2col routine. The precision is implemented using a template argument. +// Uses the tuning parameters from the regular copy kernel. // // ================================================================================================= |