From 55b3d1216b4011d86d5f06335e518dc924987ae5 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 9 May 2018 09:59:23 +0100 Subject: COMPMID-1137 OpenCL concatenate width Change-Id: I40faba421281b1cf080fa6a825d04a4366cdaeb0 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130700 Reviewed-by: Anthony Barbier Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- arm_compute/core/utils/misc/ShapeCalculator.h | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'arm_compute/core/utils') diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 30d3f9bb62..deab181aee 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -366,6 +366,35 @@ inline TensorShape compute_mm_shape(const ITensorInfo &input0, const ITensorInfo return tensor_shape; } + +template +inline TensorShape get_shape_from_info(T *info) +{ + return info->info()->tensor_shape(); +} + +inline TensorShape get_shape_from_info(ITensorInfo *info) +{ + return info->tensor_shape(); +} + +template +inline TensorShape calculate_width_concatenate_shape(const std::vector &inputs_vector) +{ + TensorShape out_shape = get_shape_from_info(inputs_vector[0]); + + size_t width = 0; + for(const auto &tensor : inputs_vector) + { + ARM_COMPUTE_ERROR_ON(tensor == nullptr); + const TensorShape shape = get_shape_from_info(tensor); + width += shape.x(); + } + + out_shape.set(0, width); + + return out_shape; +} } // namespace shape_calculator } // namespace misc } // namespace arm_compute -- cgit v1.2.1