diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2018-05-09 09:59:23 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:52:35 +0000 |
commit | 55b3d1216b4011d86d5f06335e518dc924987ae5 (patch) | |
tree | a94ca420f4385ff301a770fbeb5b4f930ac60105 /arm_compute/core/utils/misc | |
parent | a8aef2916379402e241d9f2c5e0faf3f99c860f7 (diff) | |
download | ComputeLibrary-55b3d1216b4011d86d5f06335e518dc924987ae5.tar.gz |
COMPMID-1137 OpenCL concatenate width
Change-Id: I40faba421281b1cf080fa6a825d04a4366cdaeb0
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/130700
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'arm_compute/core/utils/misc')
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 29 |
1 files changed, 29 insertions, 0 deletions
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 <typename T> +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 <typename T> +inline TensorShape calculate_width_concatenate_shape(const std::vector<T *> &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 |