diff options
author | Ioan-Cristian Szabo <ioan-cristian.szabo@arm.com> | 2017-11-30 17:17:17 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:47:40 +0000 |
commit | b4e3e1c371d8091e86ee1c6e704057559bbe1554 (patch) | |
tree | d072c9f9d7471e4df9ef5aa6b50cb09c35b0c361 /arm_compute/core/utils/misc/ShapeCalculator.h | |
parent | c1b6e37233e0ebd21cb44bf8863a09c0ba5feeb1 (diff) | |
download | ComputeLibrary-b4e3e1c371d8091e86ee1c6e704057559bbe1554.tar.gz |
COMPMID-617: Add validate support for NEON FullyConnectedLayer
Change-Id: I08987022c8d4cc335c00b8af27bd3edb8fe64d3b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111596
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Alexander Gilday <alexander.gilday@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/core/utils/misc/ShapeCalculator.h')
-rw-r--r-- | arm_compute/core/utils/misc/ShapeCalculator.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arm_compute/core/utils/misc/ShapeCalculator.h b/arm_compute/core/utils/misc/ShapeCalculator.h index c53ac4c71f..e21e5cd0d6 100644 --- a/arm_compute/core/utils/misc/ShapeCalculator.h +++ b/arm_compute/core/utils/misc/ShapeCalculator.h @@ -157,6 +157,43 @@ inline TensorShape compute_deconvolution_shape(const ITensorInfo &input, unsigne return scale_out_shape; } +inline TensorShape compute_im2col_shape(const ITensorInfo *input, const int num_input_dimensions = 3) +{ + TensorShape output_shape{ input->tensor_shape() }; + + output_shape.collapse(num_input_dimensions); + + return output_shape; +} +inline TensorShape compute_interleave_custom_shape(const TensorShape &input, const int x_interleave, const int y_interleave) +{ + TensorShape output_shape{ input }; + + output_shape.set(0, output_shape.x() * x_interleave); + output_shape.set(1, std::ceil(output_shape.y() / static_cast<float>(y_interleave))); + + return output_shape; +} + +inline TensorShape compute_fully_connected_reshaped_weights_shape(const ITensorInfo *input, bool transpose_weights, bool is_batched_fc_layer, const int interleave) +{ + TensorShape output_shape{ input->tensor_shape() }; + + // Transpose weights if the user hasn't done it + if(transpose_weights) + { + output_shape = compute_transposed_shape(*input); + } + + // If the we run multiple batches we need 1xW transpose, too. + if(is_batched_fc_layer) + { + output_shape = compute_transposed_shape(input->clone()->set_tensor_shape(output_shape)); + output_shape = compute_interleave_custom_shape(output_shape, interleave, interleave); + } + + return output_shape; +} } // namespace shape_calculator } // namespace misc } // namespace arm_compute |