aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/utils
diff options
context:
space:
mode:
authorGiorgio Arena <giorgio.arena@arm.com>2018-08-07 11:53:30 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commitc6aa49b6709edada24b1ab3bc1308e0974f9e057 (patch)
tree0509684f9f402a33d0494c1fa1f34c18f956fcf1 /arm_compute/core/utils
parentbe4100605230868b5cc50cabee395613dbfb62cd (diff)
downloadComputeLibrary-c6aa49b6709edada24b1ab3bc1308e0974f9e057.tar.gz
COMPMID-1344 Add grouping support to CLWeightsReshapeKernel
Change-Id: Idde333308db71087ec234b3fd1eb4e36a44db46c Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/143049 Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'arm_compute/core/utils')
-rw-r--r--arm_compute/core/utils/misc/ShapeCalculator.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h
index ac83dcb2cd..1e5b9afd0e 100644
--- a/arm_compute/core/utils/misc/ShapeCalculator.h
+++ b/arm_compute/core/utils/misc/ShapeCalculator.h
@@ -55,14 +55,22 @@ inline TensorShape compute_permutation_output_shape(const ITensorInfo &input, co
permute(output_shape, perm);
return output_shape;
}
-inline TensorShape compute_weights_reshaped_shape(const ITensorInfo &weights, bool has_bias = false)
+inline TensorShape compute_weights_reshaped_shape(const ITensorInfo &weights, bool has_bias = false, const unsigned int num_groups = 1)
{
+ ARM_COMPUTE_ERROR_ON(num_groups == 0);
+ ARM_COMPUTE_ERROR_ON((weights.dimension(3) % num_groups) != 0);
+ ARM_COMPUTE_ERROR_ON(weights.data_layout() == DataLayout::NHWC && num_groups > 1);
+
// Calculate output shape
TensorShape weights_reshaped{ weights.tensor_shape() };
weights_reshaped.collapse(3);
const size_t tmp_dim = weights_reshaped[0];
- weights_reshaped.set(0, weights_reshaped[1]);
+ weights_reshaped.set(0, weights_reshaped[1] / num_groups);
weights_reshaped.set(1, tmp_dim + (has_bias ? 1 : 0));
+ if(weights.num_dimensions() < 5)
+ {
+ weights_reshaped.set(2, num_groups);
+ }
return weights_reshaped;
}