aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-08-08 09:25:51 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commit980002bd5848f065b02a31bb105e47a5deb7bc98 (patch)
tree55377ff533f9c33cb505dbc358226ae57776a368 /arm_compute/core
parent0f170396e84836ad8c54d54421e95c61812968be (diff)
downloadComputeLibrary-980002bd5848f065b02a31bb105e47a5deb7bc98.tar.gz
COMPMID-1343: Add grouping support to CLCol2ImKernel
Change-Id: I5188a2163e7341f1915d98c21464fea13a9a7faf Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/143330 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Diffstat (limited to 'arm_compute/core')
-rw-r--r--arm_compute/core/CL/kernels/CLCol2ImKernel.h6
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h12
2 files changed, 13 insertions, 5 deletions
diff --git a/arm_compute/core/CL/kernels/CLCol2ImKernel.h b/arm_compute/core/CL/kernels/CLCol2ImKernel.h
index 94f21b1ebc..5c047ca091 100644
--- a/arm_compute/core/CL/kernels/CLCol2ImKernel.h
+++ b/arm_compute/core/CL/kernels/CLCol2ImKernel.h
@@ -70,18 +70,20 @@ public:
* @param[out] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM],
* while the rest represent batch of outputs. Data types supported: Same as @p input
* @param[in] convolved_dims Output convolved dimensions.
+ * @param[in] num_groups (Optional) Number of groups when performing a grouped convolution
*/
- void configure(const ICLTensor *input, ICLTensor *output, std::pair<unsigned int, unsigned int> convolved_dims);
+ void configure(const ICLTensor *input, ICLTensor *output, std::pair<unsigned int, unsigned int> convolved_dims, unsigned int num_groups = 1);
/** Static function to check if given info will lead to a valid configuration of @ref CLCol2ImKernel
*
* @param[in] input The input tensor to convert. Data types supported: QASYMM8/F16/F32
* @param[in] output The output tensor. 3 lower dimensions represent a single output [width, height, OFM],
* while the rest represent batch of outputs. Data types supported: Same as @p input
* @param[in] convolved_dims Output convolved dimensions.
+ * @param[in] num_groups (Optional) Number of groups when performing a grouped convolution
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, std::pair<unsigned int, unsigned int> convolved_dims);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, std::pair<unsigned int, unsigned int> convolved_dims, unsigned int num_groups = 1);
// Inherited methods overridden:
void run(const Window &window, cl::CommandQueue &queue) override;
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index fc6abf95f3..8a00c22306 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -140,13 +140,19 @@ inline TensorShape compute_reductionB_shape(const ITensorInfo &a)
return shape_vector_sum_row;
}
-inline TensorShape compute_col2im_shape(const ITensorInfo &input, std::pair<unsigned int, unsigned int> convolved_dims)
+inline TensorShape compute_col2im_shape(const ITensorInfo &input, std::pair<unsigned int, unsigned int> convolved_dims, unsigned int num_groups = 1)
{
+ ARM_COMPUTE_ERROR_ON(num_groups == 0);
+ ARM_COMPUTE_ERROR_ON(input.tensor_shape()[1] != (convolved_dims.first * convolved_dims.second));
+ ARM_COMPUTE_ERROR_ON((num_groups > 1) && input.tensor_shape()[2] != num_groups);
+
TensorShape col2im_shape{ input.tensor_shape() };
- col2im_shape.shift_right(1);
col2im_shape.set(0, convolved_dims.first);
col2im_shape.set(1, convolved_dims.second);
- col2im_shape.set(2, input.tensor_shape()[0]);
+ col2im_shape.set(2, input.tensor_shape()[0] * num_groups);
+
+ const unsigned int batch_idx = (num_groups == 1) ? 2 : 3;
+ col2im_shape.set(3, input.tensor_shape()[batch_idx]);
return col2im_shape;
}