diff options
-rw-r--r-- | src/runtime/CL/functions/CLConvolutionLayer.cpp | 14 | ||||
-rw-r--r-- | src/runtime/NEON/functions/NEConvolutionLayer.cpp | 16 | ||||
-rw-r--r-- | tests/datasets/SmallConvolutionLayerDataset.h | 3 |
3 files changed, 25 insertions, 8 deletions
diff --git a/src/runtime/CL/functions/CLConvolutionLayer.cpp b/src/runtime/CL/functions/CLConvolutionLayer.cpp index d628bf93ce..64c31d5191 100644 --- a/src/runtime/CL/functions/CLConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLConvolutionLayer.cpp @@ -190,9 +190,17 @@ void CLConvolutionLayer::configure(const ICLTensor *input, const ICLTensor *weig // Reshape weights if needed if(_are_weights_reshaped) { - mat_weights_cols = weights_info.num_kernels(); - const unsigned int quarter_reshaped_cols = weights->info()->dimension(0) / 4; - mat_weights_rows = quarter_reshaped_cols + bias_element; + if(_is_fully_connected_convolution || _is_quantized) + { + mat_weights_cols = weights->info()->dimension(0); + mat_weights_rows = weights->info()->dimension(1); + } + else + { + mat_weights_cols = weights_info.num_kernels(); + const unsigned int quarter_reshaped_cols = weights->info()->dimension(0) / 4; + mat_weights_rows = quarter_reshaped_cols + bias_element; + } } else { diff --git a/src/runtime/NEON/functions/NEConvolutionLayer.cpp b/src/runtime/NEON/functions/NEConvolutionLayer.cpp index 2717bbfabc..25c639f7ea 100644 --- a/src/runtime/NEON/functions/NEConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEConvolutionLayer.cpp @@ -187,9 +187,17 @@ void NEConvolutionLayer::configure(const ITensor *input, const ITensor *weights, { if(_are_weights_reshaped) { - const unsigned int transpose_width = 16 / input->info()->element_size(); - mat_weights_cols = weights_info.num_kernels(); - mat_weights_rows = weights->info()->dimension(0) / transpose_width + (_has_bias ? 1 : 0); + if(_is_fully_connected_convolution) + { + mat_weights_cols = weights_info.num_kernels(); + mat_weights_rows = weights->info()->dimension(1); + } + else + { + const unsigned int transpose_width = 16 / input->info()->element_size(); + mat_weights_cols = weights_info.num_kernels(); + mat_weights_rows = weights->info()->dimension(0) / transpose_width + (_has_bias ? 1 : 0); + } } else { @@ -267,7 +275,7 @@ void NEConvolutionLayer::configure(const ITensor *input, const ITensor *weights, // Configure matrix multiplication kernel if(_is_fully_connected_convolution) { - _mm_optimised_kernel->configure(&_input_im2col_reshaped, weights, &_gemm_output, &_workspace, 1.f, 0.f, true, false); + _mm_optimised_kernel->configure(&_input_im2col_reshaped, weights, &_gemm_output, &_workspace, 1.f, 0.f); } else { diff --git a/tests/datasets/SmallConvolutionLayerDataset.h b/tests/datasets/SmallConvolutionLayerDataset.h index ccdd6e16af..019dfe1fc6 100644 --- a/tests/datasets/SmallConvolutionLayerDataset.h +++ b/tests/datasets/SmallConvolutionLayerDataset.h @@ -70,7 +70,8 @@ public: add_config(TensorShape(17U, 31U, 2U, 4U), TensorShape(5U, 3U, 2U, 19U), TensorShape(19U), TensorShape(15U, 16U, 19U, 4U), PadStrideInfo(1, 2, 1, 1)); // Arbitrary batch size add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 11U, 16U, 5U), PadStrideInfo(3, 2, 1, 0)); - + // FC convolution + add_config(TensorShape(1U, 1U, 1024U), TensorShape(1U, 1U, 1024U, 1001U), TensorShape(1001U), TensorShape(1U, 1U, 1001U), PadStrideInfo(1, 1, 0, 0)); // Asymmetric padding add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 2, 0, DimensionRoundingType::FLOOR)); add_config(TensorShape(33U, 27U, 7U, 5U), TensorShape(5U, 7U, 7U, 16U), TensorShape(16U), TensorShape(11U, 12U, 16U, 5U), PadStrideInfo(3, 2, 1, 1, 0, 2, DimensionRoundingType::FLOOR)); |