From 78c009079654268cca9c22848e4fae9f222b100d Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Tue, 9 Jan 2018 17:33:11 +0000 Subject: COMPMID-754: Add validation to kernels. Adds validation method to: - CLConvolutionLayer Change-Id: I95516e20cfb71c1e603c60fc6491ac695883a856 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/117355 Reviewed-by: Anthony Barbier Tested-by: Jenkins --- arm_compute/core/utils/misc/ShapeCalculator.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'arm_compute/core/utils/misc') diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index e51c6bbe98..c53ac4c71f 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -40,6 +40,17 @@ 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) +{ + // 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(1, tmp_dim + (has_bias ? 1 : 0)); + + return weights_reshaped; +} inline TensorShape compute_interleaved_shape(const ITensorInfo &a, int mult_interleave4x4_height = 1) { // The interleaved output matrix will have the following shape: [ a_height * W, ceil(a_width / W) ] where W = 4 * mult_interleave4x4_height @@ -101,6 +112,15 @@ inline TensorShape compute_im2col_shape(const ITensorInfo &input) return shape_im2col; } +inline TensorShape compute_col2im_shape(const ITensorInfo &input, std::pair convolved_dims) +{ + TensorShape col2im_shape{ input.tensor_shape() }; + col2im_shape.set(0, convolved_dims.first); + col2im_shape.set(1, convolved_dims.second); + col2im_shape.set(2, input.tensor_shape()[0]); + + return col2im_shape; +} inline TensorShape compute_transposed_shape(const ITensorInfo &input) { TensorShape shape_transposed{ input.tensor_shape() }; -- cgit v1.2.1