diff options
Diffstat (limited to 'arm_compute/core')
4 files changed, 26 insertions, 46 deletions
diff --git a/arm_compute/core/CL/kernels/CLDepthConcatenateLayerKernel.h b/arm_compute/core/CL/kernels/CLDepthConcatenateLayerKernel.h index ff8009085f..2a1845226f 100644 --- a/arm_compute/core/CL/kernels/CLDepthConcatenateLayerKernel.h +++ b/arm_compute/core/CL/kernels/CLDepthConcatenateLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -73,13 +73,10 @@ public: // Inherited methods overridden: void run(const Window &window, cl::CommandQueue &queue) override; - BorderSize border_size() const override; private: const ICLTensor *_input; ICLTensor *_output; - int _top_bottom; - int _left_right; unsigned int _depth_offset; }; } // namespace arm_compute diff --git a/arm_compute/core/GLES_COMPUTE/kernels/GCDepthConcatenateLayerKernel.h b/arm_compute/core/GLES_COMPUTE/kernels/GCDepthConcatenateLayerKernel.h index 06a54dd0b3..6a03170065 100644 --- a/arm_compute/core/GLES_COMPUTE/kernels/GCDepthConcatenateLayerKernel.h +++ b/arm_compute/core/GLES_COMPUTE/kernels/GCDepthConcatenateLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -64,13 +64,10 @@ public: // Inherited methods overridden: void run(const Window &window) override; - BorderSize border_size() const override; private: const IGCTensor *_input; IGCTensor *_output; - int _top_bottom; - int _left_right; int _depth_offset; }; } diff --git a/arm_compute/core/NEON/kernels/NEDepthConcatenateLayerKernel.h b/arm_compute/core/NEON/kernels/NEDepthConcatenateLayerKernel.h index 848d89fc9f..26e23a73a5 100644 --- a/arm_compute/core/NEON/kernels/NEDepthConcatenateLayerKernel.h +++ b/arm_compute/core/NEON/kernels/NEDepthConcatenateLayerKernel.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -76,17 +76,14 @@ public: // Inherited methods overridden: void run(const Window &window, const ThreadInfo &info) override; - BorderSize border_size() const override; private: - using DepthConcatFunction = void(const ITensor *in, ITensor *out, std::pair<int, int> start_xy, int depth_offset, const Window &window); + using DepthConcatFunction = void(const ITensor *in, ITensor *out, int depth_offset, const Window &window); private: DepthConcatFunction *_func; const ITensor *_input; ITensor *_output; - int _top_bottom; - int _left_right; unsigned int _depth_offset; }; } // namespace arm_compute diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index 384bd460a0..f5058b35fb 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -1173,6 +1173,11 @@ inline TensorShape extract_shape(const TensorShape *data) return *data; } +inline TensorShape extract_shape(TensorShape *data) +{ + return *data; +} + /** Calculate the unstack shape of a tensor * * @param[in] input_shape Input tensor shape @@ -1187,37 +1192,6 @@ inline TensorShape calculate_unstack_shape(TensorShape input_shape, unsigned int return input_shape; } -/** Calculate the depth concatenate output shape of a vector of tensors - * - * @param[in] inputs_vector Vector containing the shapes of the inputs - * - * @return the calculated shape - */ -template <typename T> -inline TensorShape calculate_depth_concatenate_shape(const std::vector<T *> &inputs_vector) -{ - TensorShape out_shape = extract_shape(inputs_vector[0]); - - size_t max_x = 0; - size_t max_y = 0; - size_t depth = 0; - - for(const auto &tensor : inputs_vector) - { - ARM_COMPUTE_ERROR_ON(tensor == nullptr); - const TensorShape shape = extract_shape(tensor); - max_x = std::max(shape.x(), max_x); - max_y = std::max(shape.y(), max_y); - depth += shape.z(); - } - - out_shape.set(0, max_x); - out_shape.set(1, max_y); - out_shape.set(2, depth); - - return out_shape; -} - /** Calculate the concatenate output shape of the concatenate operation along a single axis * * @param[in] input Vector containing the shapes of the inputs @@ -1230,12 +1204,27 @@ inline TensorShape calculate_concatenate_shape(const std::vector<T *> &input, si { TensorShape out_shape = extract_shape(input[0]); + // All dimensions must match except the axis one + for(unsigned int i = 0; i < MAX_DIMS; ++i) + { + if(i == axis) + { + continue; + } + + for(const auto &tensor : input) + { + ARM_COMPUTE_ERROR_ON(tensor == nullptr); + const TensorShape shape = extract_shape(tensor); + ARM_COMPUTE_ERROR_ON(out_shape[i] != shape[i]); + } + } + + // Calculate output shape size_t new_size = 0; for(const auto &tensor : input) { - ARM_COMPUTE_ERROR_ON(tensor == nullptr); const TensorShape shape = extract_shape(tensor); - ARM_COMPUTE_ERROR_ON(axis >= shape.num_dimensions()); new_size += shape[axis]; } |