From 9d0b5f82c2734444145718f12788f2dde436ef45 Mon Sep 17 00:00:00 2001 From: Michalis Spyrou Date: Wed, 1 May 2019 13:03:59 +0100 Subject: COMPMID-2177 Fix clang warnings Change-Id: I78039db8c58d7b14a042c41e54c25fb9cb509bf7 Signed-off-by: Michalis Spyrou Reviewed-on: https://review.mlplatform.org/c/1092 Reviewed-by: VidhyaSudhan Loganathan Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- .clang-tidy | 2 +- arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h | 4 +- arm_compute/core/NEON/kernels/NECropKernel.h | 6 +- arm_compute/core/utils/logging/LoggerRegistry.h | 2 +- arm_compute/runtime/CL/CLMemory.h | 4 +- arm_compute/runtime/CL/CLMultiHOG.h | 6 +- arm_compute/runtime/CL/CLPyramid.h | 6 +- .../runtime/CL/functions/CLDepthConcatenateLayer.h | 7 +- arm_compute/runtime/CL/functions/CLFFT1D.h | 16 ++-- .../runtime/CL/functions/CLGaussianPyramid.h | 14 ++-- .../runtime/CL/functions/CLHOGMultiDetection.h | 32 ++++---- arm_compute/runtime/CL/functions/CLHarrisCorners.h | 32 ++++---- .../runtime/CL/functions/CLLaplacianPyramid.h | 16 ++-- .../runtime/CL/functions/CLLaplacianReconstruct.h | 10 +-- arm_compute/runtime/CL/functions/CLOpticalFlow.h | 14 ++-- arm_compute/runtime/CL/functions/CLPadLayer.h | 18 ++-- arm_compute/runtime/CL/functions/CLReduceMean.h | 14 ++-- .../runtime/CL/functions/CLReductionOperation.h | 14 ++-- arm_compute/runtime/CL/functions/CLSplit.h | 8 +- arm_compute/runtime/CL/functions/CLStackLayer.h | 6 +- arm_compute/runtime/CL/functions/CLUnstack.h | 6 +- .../runtime/CL/functions/CLWidthConcatenateLayer.h | 8 +- arm_compute/runtime/Distribution1D.h | 5 +- arm_compute/runtime/GLES_COMPUTE/GCMemory.h | 4 +- arm_compute/runtime/HOG.h | 6 +- arm_compute/runtime/LutAllocator.h | 4 +- arm_compute/runtime/Memory.h | 4 +- arm_compute/runtime/MultiHOG.h | 6 +- .../runtime/NEON/functions/NEHarrisCorners.h | 4 +- arm_compute/runtime/NEON/functions/NEHistogram.h | 10 +-- .../runtime/NEON/functions/NELaplacianPyramid.h | 16 ++-- .../NEON/functions/NELaplacianReconstruct.h | 10 +-- arm_compute/runtime/NEON/functions/NEPadLayer.h | 20 ++--- arm_compute/runtime/NEON/functions/NEReduceMean.h | 14 ++-- arm_compute/runtime/NEON/functions/NESplit.h | 6 +- arm_compute/runtime/NEON/functions/NEStackLayer.h | 6 +- arm_compute/runtime/NEON/functions/NEUnstack.h | 4 +- .../NEON/functions/NEWidthConcatenateLayer.h | 4 +- arm_compute/runtime/Pyramid.h | 6 +- examples/gc_absdiff.cpp | 5 +- examples/gc_dc.cpp | 4 +- examples/graph_deepspeech_v0_4_1.cpp | 23 +++--- examples/neon_convolution.cpp | 10 +-- examples/neon_sgemm.cpp | 6 +- scripts/clang_tidy_rules.py | 8 ++ src/core/AccessWindowAutoPadding.cpp | 6 +- src/core/CL/kernels/CLComparisonKernel.cpp | 4 +- .../CL/kernels/CLElementwiseOperationKernel.cpp | 4 +- src/core/CL/kernels/CLGaussian5x5Kernel.cpp | 12 +-- src/core/CL/kernels/CLGaussianPyramidKernel.cpp | 6 +- src/core/CL/kernels/CLMinMaxLayerKernel.cpp | 4 +- src/core/CPP/kernels/CPPUpsampleKernel.cpp | 2 +- src/core/Error.cpp | 11 +-- src/core/GLES_COMPUTE/GCKernelLibrary.cpp | 6 +- .../GLES_COMPUTE/kernels/GCPoolingLayerKernel.cpp | 7 +- src/core/NEON/kernels/NECropKernel.cpp | 2 +- src/core/NEON/kernels/NEDilateKernel.cpp | 5 +- .../kernels/NEDirectConvolutionLayerKernel.cpp | 14 ++-- src/core/NEON/kernels/NEErodeKernel.cpp | 5 +- src/core/NEON/kernels/NEFillBorderKernel.cpp | 8 +- .../NEON/kernels/NEGEMMInterleave4x4Kernel.cpp | 4 +- src/core/NEON/kernels/NELKTrackerKernel.cpp | 12 +-- src/core/NEON/kernels/NEPoolingLayerKernel.cpp | 3 +- src/core/NEON/kernels/NERemapKernel.cpp | 10 +-- src/core/NEON/kernels/NEScaleKernel.cpp | 5 +- src/core/utils/helpers/tensor_transform.cpp | 1 + src/core/utils/logging/LoggerRegistry.cpp | 4 +- src/runtime/BlobLifetimeManager.cpp | 4 +- src/runtime/CL/CLHelpers.cpp | 18 ++-- src/runtime/CL/CLMemory.cpp | 6 +- src/runtime/CL/CLMultiHOG.cpp | 9 +- src/runtime/CL/CLPyramid.cpp | 14 ++-- src/runtime/CL/CLTensorAllocator.cpp | 2 +- src/runtime/CL/CLTuner.cpp | 2 +- src/runtime/CL/functions/CLConvolution.cpp | 12 +-- .../CL/functions/CLDepthConcatenateLayer.cpp | 7 +- .../CL/functions/CLDepthwiseConvolutionLayer.cpp | 3 +- src/runtime/CL/functions/CLFFT1D.cpp | 2 +- .../CL/functions/CLGEMMConvolutionLayer.cpp | 4 +- src/runtime/CL/functions/CLGaussianPyramid.cpp | 14 ++-- src/runtime/CL/functions/CLHOGMultiDetection.cpp | 29 ++++--- src/runtime/CL/functions/CLHarrisCorners.cpp | 8 +- src/runtime/CL/functions/CLLaplacianPyramid.cpp | 6 +- .../CL/functions/CLLaplacianReconstruct.cpp | 8 +- src/runtime/CL/functions/CLOpticalFlow.cpp | 16 ++-- src/runtime/CL/functions/CLPadLayer.cpp | 17 ++-- src/runtime/CL/functions/CLReduceMean.cpp | 18 ++-- src/runtime/CL/functions/CLReductionOperation.cpp | 28 +++---- src/runtime/CL/functions/CLSplit.cpp | 6 +- src/runtime/CL/functions/CLStackLayer.cpp | 4 +- src/runtime/CL/functions/CLUnstack.cpp | 4 +- .../CL/functions/CLWidthConcatenateLayer.cpp | 2 +- src/runtime/CL/tuners/CLLWSList.cpp | 4 +- .../CPP/functions/CPPDetectionOutputLayer.cpp | 4 +- src/runtime/CPUUtils.cpp | 38 ++++----- src/runtime/Distribution1D.cpp | 7 +- src/runtime/GLES_COMPUTE/GCMemory.cpp | 6 +- src/runtime/GLES_COMPUTE/GCScheduler.cpp | 10 +-- src/runtime/HOG.cpp | 11 ++- src/runtime/LutAllocator.cpp | 10 +-- src/runtime/Memory.cpp | 6 +- src/runtime/MultiHOG.cpp | 9 +- src/runtime/NEON/functions/NEConcatenateLayer.cpp | 1 + .../NEON/functions/NEGEMMAssemblyDispatch.cpp | 2 +- src/runtime/NEON/functions/NEHarrisCorners.cpp | 6 +- src/runtime/NEON/functions/NEHistogram.cpp | 8 +- src/runtime/NEON/functions/NELaplacianPyramid.cpp | 6 +- .../NEON/functions/NELaplacianReconstruct.cpp | 8 +- src/runtime/NEON/functions/NEPadLayer.cpp | 22 +++-- src/runtime/NEON/functions/NEReduceMean.cpp | 18 ++-- src/runtime/NEON/functions/NESplit.cpp | 4 +- src/runtime/NEON/functions/NEStackLayer.cpp | 4 +- src/runtime/NEON/functions/NEUnstack.cpp | 2 +- .../NEON/functions/NEWidthConcatenateLayer.cpp | 4 +- src/runtime/Pyramid.cpp | 26 +++--- tests/framework/instruments/OpenCLMemoryUsage.cpp | 4 +- tests/framework/instruments/OpenCLTimer.cpp | 7 +- tests/framework/instruments/SchedulerTimer.cpp | 8 +- tests/framework/printers/JSONPrinter.cpp | 4 +- tests/framework/printers/PrettyPrinter.cpp | 4 +- tests/validation/CL/Convolution.cpp | 20 ++--- tests/validation/CL/DepthConcatenateLayer.cpp | 1 + tests/validation/CL/NonLinearFilter.cpp | 6 +- tests/validation/CL/Split.cpp | 4 +- tests/validation/CL/WidthConcatenateLayer.cpp | 1 + tests/validation/Helpers.cpp | 2 +- tests/validation/NEON/DepthConcatenateLayer.cpp | 1 + tests/validation/NEON/HeightConcatenateLayer.cpp | 1 + tests/validation/NEON/NonLinearFilter.cpp | 6 +- tests/validation/NEON/Split.cpp | 2 + tests/validation/NEON/WidthConcatenateLayer.cpp | 1 + tests/validation/reference/ArithmeticDivision.cpp | 6 +- .../validation/reference/ArithmeticOperations.cpp | 14 ++-- tests/validation/reference/CannyEdgeDetector.cpp | 8 +- tests/validation/reference/Comparisons.cpp | 13 +-- tests/validation/reference/ConcatenateLayer.cpp | 1 + .../validation/reference/DepthConcatenateLayer.cpp | 4 +- .../validation/reference/ElementwiseOperations.cpp | 12 ++- tests/validation/reference/HOGDetector.cpp | 6 +- .../reference/PixelWiseMultiplication.cpp | 8 +- tests/validation/reference/SliceOperations.cpp | 6 +- tests/validation/reference/Sobel.cpp | 2 +- tests/validation/reference/StackLayer.cpp | 6 +- tests/validation/reference/Winograd.cpp | 96 +++++++++++----------- 144 files changed, 671 insertions(+), 607 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index ad2dbb7a19..e7896360bf 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: 'clang-diagnostic-*,clang-analyzer-*,*,-abseil-*,-fuchsia-*,-bugprone-*,-hicpp-*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cert-err58-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-google-runtime-references,-google-build-using-namespace,-readability-redundant-member-init,-readability-redundant-declaration,-readability-else-after-return,-performance-type-promotion-in-math-fn,-cert-err60-cpp,-cppcoreguidelines-narrowing-conversions,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-clang-analyzer-optin.cplusplus.VirtualCall' +Checks: 'clang-diagnostic-*,clang-analyzer-*,*,-abseil-*,-fuchsia-*,-bugprone-*,-hicpp-*,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-constant-array-index,-cert-err58-cpp,-cppcoreguidelines-pro-type-reinterpret-cast,-google-runtime-references,-google-build-using-namespace,-readability-redundant-member-init,-readability-redundant-declaration,-readability-else-after-return,-performance-type-promotion-in-math-fn,-cert-err60-cpp,-cppcoreguidelines-narrowing-conversions,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers,-readability-named-parameter,-readability-implicit-bool-conversion,-readability-uppercase-literal-suffix,-clang-analyzer-optin.cplusplus.VirtualCall,-cppcoreguidelines-macro-usage' WarningsAsErrors: '' HeaderFilterRegex: '' AnalyzeTemporaryDtors: false diff --git a/arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h b/arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h index c0d64e2edb..89d6d17eb5 100644 --- a/arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h +++ b/arm_compute/core/GLES_COMPUTE/GCKernelLibrary.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -271,7 +271,7 @@ private: * * @return Preprocessed GLES shader object. */ - const std::string preprocess_shader(const std::string &shader_source) const; + std::string preprocess_shader(const std::string &shader_source) const; /** Load program and its dependencies. * * @param[in] program_name Name of the program to load. diff --git a/arm_compute/core/NEON/kernels/NECropKernel.h b/arm_compute/core/NEON/kernels/NECropKernel.h index 6713a40c86..ef89d112f6 100644 --- a/arm_compute/core/NEON/kernels/NECropKernel.h +++ b/arm_compute/core/NEON/kernels/NECropKernel.h @@ -107,14 +107,14 @@ private: uint32_t _crop_box_ind; float _extrapolation_value; /** The number of rows out of bounds at the start and end of output. */ - uint32_t _rows_out_of_bounds[2]; + std::array _rows_out_of_bounds; /** The number of columns out of bounds at the start and end of output. */ - uint32_t _cols_out_of_bounds[2]; + std::array _cols_out_of_bounds; std::pair _in_bounds_crop_functions; NECropKernel::InBoundsCropFunction *_in_bounds_crop_function; - using CropFunction = void(const ITensor *, const ITensor *, Coordinates, float, const uint32_t *, const uint32_t *, + using CropFunction = void(const ITensor *, const ITensor *, Coordinates, float, const std::array &, const std::array &, NECropKernel::InBoundsCropFunction *); NECropKernel::CropFunction *_crop_function; diff --git a/arm_compute/core/utils/logging/LoggerRegistry.h b/arm_compute/core/utils/logging/LoggerRegistry.h index c841020c22..0e223ff663 100644 --- a/arm_compute/core/utils/logging/LoggerRegistry.h +++ b/arm_compute/core/utils/logging/LoggerRegistry.h @@ -55,7 +55,7 @@ public: * @param[in] printers Printers to attach to the system loggers. Defaults with a @ref StdPrinter. */ void create_logger(const std::string &name, LogLevel log_level = LogLevel::INFO, - std::vector> printers = { std::make_shared() }); + const std::vector> &printers = { std::make_shared() }); /** Remove a logger * * @param name Logger's name diff --git a/arm_compute/runtime/CL/CLMemory.h b/arm_compute/runtime/CL/CLMemory.h index 02d36614ae..48692e17a9 100644 --- a/arm_compute/runtime/CL/CLMemory.h +++ b/arm_compute/runtime/CL/CLMemory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,7 +44,7 @@ public: * * @param[in] memory Memory to be imported */ - CLMemory(std::shared_ptr memory); + CLMemory(const std::shared_ptr &memory); /** Default Constructor * * @note Ownership of the memory is not transferred to this object. diff --git a/arm_compute/runtime/CL/CLMultiHOG.h b/arm_compute/runtime/CL/CLMultiHOG.h index 17bb4e03c1..b7d03bfa3b 100644 --- a/arm_compute/runtime/CL/CLMultiHOG.h +++ b/arm_compute/runtime/CL/CLMultiHOG.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -49,8 +49,8 @@ public: const ICLHOG *cl_model(size_t index) const override; private: - size_t _num_models; - std::unique_ptr _model; + size_t _num_models; + std::vector _model; }; } #endif /*__ARM_COMPUTE_CLMULTIHOG_H__ */ diff --git a/arm_compute/runtime/CL/CLPyramid.h b/arm_compute/runtime/CL/CLPyramid.h index 5e0afb3c63..b66bc3b71c 100644 --- a/arm_compute/runtime/CL/CLPyramid.h +++ b/arm_compute/runtime/CL/CLPyramid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -75,8 +75,8 @@ private: */ void internal_init(const PyramidInfo &info, bool auto_padding); - PyramidInfo _info; - std::unique_ptr _pyramid; + PyramidInfo _info; + mutable std::vector _pyramid; }; } #endif /*__ARM_COMPUTE_CLPYRAMID_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h b/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h index 33f751f6db..9ef21f32d7 100644 --- a/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h +++ b/arm_compute/runtime/CL/functions/CLDepthConcatenateLayer.h @@ -87,10 +87,9 @@ public: void run() override; private: - std::vector _inputs_vector; - std::unique_ptr _concat_kernels_vector; - std::unique_ptr _border_handlers_vector; - unsigned int _num_inputs; + std::vector _concat_kernels_vector; + std::vector _border_handlers_vector; + unsigned int _num_inputs; }; } #endif /* __ARM_COMPUTE_CLDEPTHCONCATENATE_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLFFT1D.h b/arm_compute/runtime/CL/functions/CLFFT1D.h index 029023c524..c7f90dd0fe 100644 --- a/arm_compute/runtime/CL/functions/CLFFT1D.h +++ b/arm_compute/runtime/CL/functions/CLFFT1D.h @@ -70,14 +70,14 @@ public: void run() override; protected: - CLMemoryGroup _memory_group; - CLFFTDigitReverseKernel _digit_reverse_kernel; - std::unique_ptr _fft_kernels; - CLFFTScaleKernel _scale_kernel; - CLTensor _digit_reversed_input; - CLTensor _digit_reverse_indices; - unsigned int _num_ffts; - bool _run_scale; + CLMemoryGroup _memory_group; + CLFFTDigitReverseKernel _digit_reverse_kernel; + std::vector _fft_kernels; + CLFFTScaleKernel _scale_kernel; + CLTensor _digit_reversed_input; + CLTensor _digit_reverse_indices; + unsigned int _num_ffts; + bool _run_scale; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_CLFFT1D_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLGaussianPyramid.h b/arm_compute/runtime/CL/functions/CLGaussianPyramid.h index 0110adfa20..332f806a27 100644 --- a/arm_compute/runtime/CL/functions/CLGaussianPyramid.h +++ b/arm_compute/runtime/CL/functions/CLGaussianPyramid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -90,10 +90,10 @@ public: void run() override; private: - std::unique_ptr _horizontal_border_handler; - std::unique_ptr _vertical_border_handler; - std::unique_ptr _horizontal_reduction; - std::unique_ptr _vertical_reduction; + std::vector _horizontal_border_handler; + std::vector _vertical_border_handler; + std::vector _horizontal_reduction; + std::vector _vertical_reduction; }; /** Basic function to execute gaussian pyramid with ORB scale factor. This function calls the following OpenCL kernels and functions: @@ -113,8 +113,8 @@ public: void run() override; private: - std::unique_ptr _gauss5x5; - std::unique_ptr _scale_nearest; + std::vector _gauss5x5; + std::vector _scale_nearest; }; } #endif /*__ARM_COMPUTE_CLGAUSSIANPYRAMID_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h b/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h index 1ff986511e..9241723771 100644 --- a/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h +++ b/arm_compute/runtime/CL/functions/CLHOGMultiDetection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -89,21 +89,21 @@ public: void run() override; private: - CLMemoryGroup _memory_group; - CLHOGGradient _gradient_kernel; - std::unique_ptr _orient_bin_kernel; - std::unique_ptr _block_norm_kernel; - std::unique_ptr _hog_detect_kernel; - std::unique_ptr _non_maxima_kernel; - std::unique_ptr _hog_space; - std::unique_ptr _hog_norm_space; - ICLDetectionWindowArray *_detection_windows; - CLTensor _mag; - CLTensor _phase; - bool _non_maxima_suppression; - size_t _num_orient_bin_kernel; - size_t _num_block_norm_kernel; - size_t _num_hog_detect_kernel; + CLMemoryGroup _memory_group; + CLHOGGradient _gradient_kernel; + std::vector _orient_bin_kernel; + std::vector _block_norm_kernel; + std::vector _hog_detect_kernel; + CPPDetectionWindowNonMaximaSuppressionKernel _non_maxima_kernel; + std::vector _hog_space; + std::vector _hog_norm_space; + ICLDetectionWindowArray *_detection_windows; + CLTensor _mag; + CLTensor _phase; + bool _non_maxima_suppression; + size_t _num_orient_bin_kernel; + size_t _num_block_norm_kernel; + size_t _num_hog_detect_kernel; }; } diff --git a/arm_compute/runtime/CL/functions/CLHarrisCorners.h b/arm_compute/runtime/CL/functions/CLHarrisCorners.h index 4cb7fbd307..52041a96fc 100644 --- a/arm_compute/runtime/CL/functions/CLHarrisCorners.h +++ b/arm_compute/runtime/CL/functions/CLHarrisCorners.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -87,21 +87,21 @@ public: void run() override; private: - CLMemoryGroup _memory_group; /**< Function's memory group */ - std::unique_ptr _sobel; /**< Sobel function */ - CLHarrisScoreKernel _harris_score; /**< Harris score kernel */ - CLNonMaximaSuppression3x3 _non_max_suppr; /**< Non-maxima suppression function */ - CPPCornerCandidatesKernel _candidates; /**< Sort kernel */ - CPPSortEuclideanDistanceKernel _sort_euclidean; /**< Euclidean distance kernel */ - CLFillBorderKernel _border_gx; /**< Border handler before running harris score */ - CLFillBorderKernel _border_gy; /**< Border handler before running harris score */ - CLImage _gx; /**< Source image - Gx component */ - CLImage _gy; /**< Source image - Gy component */ - CLImage _score; /**< Source image - Harris score */ - CLImage _nonmax; /**< Source image - Non-Maxima suppressed image */ - std::unique_ptr _corners_list; /**< Array of InternalKeypoint. It stores the potential corner candidates */ - int32_t _num_corner_candidates; /**< Number of potential corner candidates */ - ICLKeyPointArray *_corners; /**< Output corners array */ + CLMemoryGroup _memory_group; /**< Function's memory group */ + std::unique_ptr _sobel; /**< Sobel function */ + CLHarrisScoreKernel _harris_score; /**< Harris score kernel */ + CLNonMaximaSuppression3x3 _non_max_suppr; /**< Non-maxima suppression function */ + CPPCornerCandidatesKernel _candidates; /**< Sort kernel */ + CPPSortEuclideanDistanceKernel _sort_euclidean; /**< Euclidean distance kernel */ + CLFillBorderKernel _border_gx; /**< Border handler before running harris score */ + CLFillBorderKernel _border_gy; /**< Border handler before running harris score */ + CLImage _gx; /**< Source image - Gx component */ + CLImage _gy; /**< Source image - Gy component */ + CLImage _score; /**< Source image - Harris score */ + CLImage _nonmax; /**< Source image - Non-Maxima suppressed image */ + std::vector _corners_list; /**< Array of InternalKeypoint. It stores the potential corner candidates */ + int32_t _num_corner_candidates; /**< Number of potential corner candidates */ + ICLKeyPointArray *_corners; /**< Output corners array */ }; } #endif /*__ARM_COMPUTE_CLHARRISCORNERS_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h b/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h index ae86e931df..72872045ff 100644 --- a/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h +++ b/arm_compute/runtime/CL/functions/CLLaplacianPyramid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -73,13 +73,13 @@ public: void run() override; private: - size_t _num_levels; - CLGaussianPyramidHalf _gaussian_pyr_function; - std::unique_ptr _convf; - std::unique_ptr _subf; - CLDepthConvertLayer _depth_function; - CLPyramid _gauss_pyr; - CLPyramid _conv_pyr; + size_t _num_levels; + CLGaussianPyramidHalf _gaussian_pyr_function; + std::vector _convf; + std::vector _subf; + CLDepthConvertLayer _depth_function; + CLPyramid _gauss_pyr; + CLPyramid _conv_pyr; }; } #endif /*__ARM_COMPUTE_CLLAPLACIANPYRAMID_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h b/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h index 622b049f11..8bae1199a6 100644 --- a/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h +++ b/arm_compute/runtime/CL/functions/CLLaplacianReconstruct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -82,10 +82,10 @@ public: void run() override; private: - CLPyramid _tmp_pyr; - std::unique_ptr _addf; - std::unique_ptr _scalef; - CLDepthConvertLayer _depthf; + CLPyramid _tmp_pyr; + std::vector _addf; + std::vector _scalef; + CLDepthConvertLayer _depthf; }; } #endif /*__ARM_COMPUTE_CLLAPLACIANRECONSTRUCT_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLOpticalFlow.h b/arm_compute/runtime/CL/functions/CLOpticalFlow.h index e2aaf404ce..a0a947188a 100644 --- a/arm_compute/runtime/CL/functions/CLOpticalFlow.h +++ b/arm_compute/runtime/CL/functions/CLOpticalFlow.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -97,13 +97,13 @@ public: private: CLMemoryGroup _memory_group; - std::unique_ptr _tracker_init_kernel; - std::unique_ptr _tracker_stage0_kernel; - std::unique_ptr _tracker_stage1_kernel; + std::vector _tracker_init_kernel; + std::vector _tracker_stage0_kernel; + std::vector _tracker_stage1_kernel; CLLKTrackerFinalizeKernel _tracker_finalize_kernel; - std::unique_ptr _func_scharr; - std::unique_ptr _scharr_gx; - std::unique_ptr _scharr_gy; + std::vector _func_scharr; + std::vector _scharr_gx; + std::vector _scharr_gy; const ICLKeyPointArray *_old_points; const ICLKeyPointArray *_new_points_estimates; ICLKeyPointArray *_new_points; diff --git a/arm_compute/runtime/CL/functions/CLPadLayer.h b/arm_compute/runtime/CL/functions/CLPadLayer.h index 33b09d60a2..7f140d9e1d 100644 --- a/arm_compute/runtime/CL/functions/CLPadLayer.h +++ b/arm_compute/runtime/CL/functions/CLPadLayer.h @@ -83,15 +83,15 @@ private: void configure_constant_mode(ICLTensor *input, ICLTensor *output, const PaddingList &padding, const PixelValue constant_value); void configure_reflect_symmetric_mode(ICLTensor *input, ICLTensor *output); - CLCopyKernel _copy_kernel; - PaddingMode _mode; - PaddingList _padding; - CLMemsetKernel _memset_kernel; - size_t _num_dimensions; - std::unique_ptr _slice_functions; - std::unique_ptr _concat_functions; - std::unique_ptr _slice_results; - std::unique_ptr _concat_results; + CLCopyKernel _copy_kernel; + PaddingMode _mode; + PaddingList _padding; + CLMemsetKernel _memset_kernel; + size_t _num_dimensions; + std::vector _slice_functions; + std::vector _concat_functions; + std::vector _slice_results; + std::vector _concat_results; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_PADLAYER_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLReduceMean.h b/arm_compute/runtime/CL/functions/CLReduceMean.h index ba10134a00..9c087eadf1 100644 --- a/arm_compute/runtime/CL/functions/CLReduceMean.h +++ b/arm_compute/runtime/CL/functions/CLReduceMean.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -67,12 +67,12 @@ public: void run() override; private: - CLMemoryGroup _memory_group; - std::unique_ptr _reduction_kernels{ nullptr }; - std::unique_ptr _reduced_outs{ nullptr }; - CLReshapeLayer _reshape; - unsigned int _reduction_ops; - bool _keep_dims; + CLMemoryGroup _memory_group; + std::vector _reduction_kernels; + std::vector _reduced_outs; + CLReshapeLayer _reshape; + unsigned int _reduction_ops; + bool _keep_dims; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_CL_REDUCE_MEAN_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLReductionOperation.h b/arm_compute/runtime/CL/functions/CLReductionOperation.h index 977562d993..4b0adc243d 100644 --- a/arm_compute/runtime/CL/functions/CLReductionOperation.h +++ b/arm_compute/runtime/CL/functions/CLReductionOperation.h @@ -75,13 +75,13 @@ public: void run() override; private: - CLMemoryGroup _memory_group; - std::unique_ptr _results_vector{ nullptr }; - std::unique_ptr _reduction_kernels_vector{ nullptr }; - std::unique_ptr _border_handlers_vector{ nullptr }; - unsigned int _num_of_stages; - unsigned int _reduction_axis; - bool _is_serial; + CLMemoryGroup _memory_group; + std::vector _results_vector; + std::vector _reduction_kernels_vector; + std::vector _border_handlers_vector; + unsigned int _num_of_stages; + unsigned int _reduction_axis; + bool _is_serial; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_CLREDUCTIONOPERATION_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLSplit.h b/arm_compute/runtime/CL/functions/CLSplit.h index 47da177932..709be3bb38 100644 --- a/arm_compute/runtime/CL/functions/CLSplit.h +++ b/arm_compute/runtime/CL/functions/CLSplit.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -68,9 +68,9 @@ public: void run() override; private: - std::vector _outputs_vector; - std::unique_ptr _slice_functions; - unsigned int _num_outputs; + std::vector _outputs_vector; + std::vector _slice_functions; + unsigned int _num_outputs; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_CLSPLIT_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLStackLayer.h b/arm_compute/runtime/CL/functions/CLStackLayer.h index 5b821b863a..30676e1dd3 100644 --- a/arm_compute/runtime/CL/functions/CLStackLayer.h +++ b/arm_compute/runtime/CL/functions/CLStackLayer.h @@ -73,9 +73,9 @@ public: void run() override; private: - std::vector _input; - std::unique_ptr _stack_kernels; - unsigned int _num_inputs; + std::vector _input; + std::vector _stack_kernels; + unsigned int _num_inputs; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_CLSTACKLAYER_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLUnstack.h b/arm_compute/runtime/CL/functions/CLUnstack.h index feed430c58..bc32a3db1e 100644 --- a/arm_compute/runtime/CL/functions/CLUnstack.h +++ b/arm_compute/runtime/CL/functions/CLUnstack.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -69,8 +69,8 @@ public: void run() override; private: - unsigned int _num_slices; - std::unique_ptr _strided_slice_vector; + unsigned int _num_slices; + std::vector _strided_slice_vector; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_CLUNSTACK_H__ */ diff --git a/arm_compute/runtime/CL/functions/CLWidthConcatenateLayer.h b/arm_compute/runtime/CL/functions/CLWidthConcatenateLayer.h index a87ec3094c..6a30fcfa92 100644 --- a/arm_compute/runtime/CL/functions/CLWidthConcatenateLayer.h +++ b/arm_compute/runtime/CL/functions/CLWidthConcatenateLayer.h @@ -79,10 +79,10 @@ public: void run() override; private: - std::unique_ptr _concat_kernels_vector; - CLWidthConcatenate2TensorsKernel _concat_x2_kernel; - CLWidthConcatenate4TensorsKernel _concat_x4_kernel; - unsigned int _num_inputs; + std::vector _concat_kernels_vector; + CLWidthConcatenate2TensorsKernel _concat_x2_kernel; + CLWidthConcatenate4TensorsKernel _concat_x4_kernel; + unsigned int _num_inputs; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_CLWIDTHCONCATENATELAYER_H__ */ diff --git a/arm_compute/runtime/Distribution1D.h b/arm_compute/runtime/Distribution1D.h index 7080e88075..180abdcf2d 100644 --- a/arm_compute/runtime/Distribution1D.h +++ b/arm_compute/runtime/Distribution1D.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -29,6 +29,7 @@ #include #include #include +#include namespace arm_compute { @@ -49,7 +50,7 @@ public: uint32_t *buffer() const override; private: - std::unique_ptr _data; /**< The distribution data. */ + mutable std::vector _data; /**< The distribution data. */ }; } #endif /* __ARM_COMPUTE_DISTRIBUTION1D_H__ */ diff --git a/arm_compute/runtime/GLES_COMPUTE/GCMemory.h b/arm_compute/runtime/GLES_COMPUTE/GCMemory.h index bf0428a341..d8de800857 100644 --- a/arm_compute/runtime/GLES_COMPUTE/GCMemory.h +++ b/arm_compute/runtime/GLES_COMPUTE/GCMemory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -43,7 +43,7 @@ public: * * @param[in] memory Memory to be imported */ - GCMemory(std::shared_ptr memory); + GCMemory(const std::shared_ptr &memory); /** Default Constructor * * @note Ownership of the memory is not transferred to this object. diff --git a/arm_compute/runtime/HOG.h b/arm_compute/runtime/HOG.h index 70d8034bef..3dc2f32b65 100644 --- a/arm_compute/runtime/HOG.h +++ b/arm_compute/runtime/HOG.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -49,8 +49,8 @@ public: float *descriptor() const override; private: - HOGInfo _info; - std::unique_ptr _descriptor; + HOGInfo _info; + mutable std::vector _descriptor; }; } #endif /* __ARM_COMPUTE_HOG_H__ */ diff --git a/arm_compute/runtime/LutAllocator.h b/arm_compute/runtime/LutAllocator.h index 077b4693af..11589daa7e 100644 --- a/arm_compute/runtime/LutAllocator.h +++ b/arm_compute/runtime/LutAllocator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -55,7 +55,7 @@ protected: void unlock() override; private: - std::unique_ptr _buffer; /**< CPU memory allocation. */ + mutable std::vector _buffer; /**< CPU memory allocation. */ }; } #endif /* __ARM_COMPUTE_LUTALLOCATOR_H__ */ diff --git a/arm_compute/runtime/Memory.h b/arm_compute/runtime/Memory.h index 6f5254a689..1a00ed2f53 100644 --- a/arm_compute/runtime/Memory.h +++ b/arm_compute/runtime/Memory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -43,7 +43,7 @@ public: * * @param[in] memory Memory to be imported */ - Memory(std::shared_ptr memory); + Memory(const std::shared_ptr &memory); /** Default Constructor * * @note Ownership of the memory is not transferred to this object. diff --git a/arm_compute/runtime/MultiHOG.h b/arm_compute/runtime/MultiHOG.h index 32bad70738..45b3947eda 100644 --- a/arm_compute/runtime/MultiHOG.h +++ b/arm_compute/runtime/MultiHOG.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -50,8 +50,8 @@ public: const IHOG *model(size_t index) const override; private: - size_t _num_models; - std::unique_ptr _model; + size_t _num_models; + std::vector _model; }; } diff --git a/arm_compute/runtime/NEON/functions/NEHarrisCorners.h b/arm_compute/runtime/NEON/functions/NEHarrisCorners.h index b35a9add04..03ab1d0c23 100644 --- a/arm_compute/runtime/NEON/functions/NEHarrisCorners.h +++ b/arm_compute/runtime/NEON/functions/NEHarrisCorners.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -100,7 +100,7 @@ private: Image _gy; /**< Source image - Gy component */ Image _score; /**< Source image - Harris score */ Image _nonmax; /**< Source image - Non-Maxima suppressed image */ - std::unique_ptr _corners_list; /**< Array of InternalKeypoint. It stores the potential corner candidates */ + std::vector _corners_list; /**< Array of InternalKeypoint. It stores the potential corner candidates */ int32_t _num_corner_candidates; /**< Number of potential corner candidates */ }; } diff --git a/arm_compute/runtime/NEON/functions/NEHistogram.h b/arm_compute/runtime/NEON/functions/NEHistogram.h index c24510dcb3..dbed4a0653 100644 --- a/arm_compute/runtime/NEON/functions/NEHistogram.h +++ b/arm_compute/runtime/NEON/functions/NEHistogram.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -52,10 +52,10 @@ public: void run() override; private: - NEHistogramKernel _histogram_kernel; - std::unique_ptr _local_hist; - std::unique_ptr _window_lut; - size_t _local_hist_size; + NEHistogramKernel _histogram_kernel; + std::vector _local_hist; + std::vector _window_lut; + size_t _local_hist_size; /** 256 possible pixel values as we handle only U8 images */ static constexpr unsigned int window_lut_default_size = 256; }; diff --git a/arm_compute/runtime/NEON/functions/NELaplacianPyramid.h b/arm_compute/runtime/NEON/functions/NELaplacianPyramid.h index baa4b7b1a5..decd91863a 100644 --- a/arm_compute/runtime/NEON/functions/NELaplacianPyramid.h +++ b/arm_compute/runtime/NEON/functions/NELaplacianPyramid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -73,13 +73,13 @@ public: void run() override; private: - size_t _num_levels; - NEGaussianPyramidHalf _gaussian_pyr_function; - std::unique_ptr _convf; - std::unique_ptr _subf; - Pyramid _gauss_pyr; - Pyramid _conv_pyr; - NEDepthConvertLayer _depth_function; + size_t _num_levels; + NEGaussianPyramidHalf _gaussian_pyr_function; + std::vector _convf; + std::vector _subf; + Pyramid _gauss_pyr; + Pyramid _conv_pyr; + NEDepthConvertLayer _depth_function; }; } #endif /*__ARM_COMPUTE_NELAPLACIANPYRAMID_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h b/arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h index 2143042bd3..533903a726 100644 --- a/arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h +++ b/arm_compute/runtime/NEON/functions/NELaplacianReconstruct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -82,10 +82,10 @@ public: void run() override; private: - Pyramid _tmp_pyr; - std::unique_ptr _addf; - std::unique_ptr _scalef; - NEDepthConvertLayer _depthf; + Pyramid _tmp_pyr; + std::vector _addf; + std::vector _scalef; + NEDepthConvertLayer _depthf; }; } #endif /*__ARM_COMPUTE_NELAPLACIANRECONSTRUCT_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEPadLayer.h b/arm_compute/runtime/NEON/functions/NEPadLayer.h index 78dbc1f1f9..67f68b86d3 100644 --- a/arm_compute/runtime/NEON/functions/NEPadLayer.h +++ b/arm_compute/runtime/NEON/functions/NEPadLayer.h @@ -92,16 +92,16 @@ private: void configure_reflect_symmetric_mode(ITensor *input, ITensor *output); private: - NECopyKernel _copy_kernel; - PaddingMode _mode; - PaddingList _padding; - NEMemsetKernel _memset_kernel; - uint32_t _num_dimensions; - std::unique_ptr _slice_functions; - std::unique_ptr _concat_functions; - std::unique_ptr _slice_results; - std::unique_ptr _concat_results; - SubTensor _output_subtensor; + NECopyKernel _copy_kernel; + PaddingMode _mode; + PaddingList _padding; + NEMemsetKernel _memset_kernel; + uint32_t _num_dimensions; + std::vector _slice_functions; + std::vector _concat_functions; + std::vector _slice_results; + std::vector _concat_results; + SubTensor _output_subtensor; }; } // namespace arm_compute #endif /*__ARM_COMPUTE_NEPADLAYER_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEReduceMean.h b/arm_compute/runtime/NEON/functions/NEReduceMean.h index b20ca9cc1b..fdd8edfe87 100644 --- a/arm_compute/runtime/NEON/functions/NEReduceMean.h +++ b/arm_compute/runtime/NEON/functions/NEReduceMean.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -68,12 +68,12 @@ public: void run() override; private: - MemoryGroup _memory_group; - std::unique_ptr _reduction_kernels{ nullptr }; - std::unique_ptr _reduced_outs{ nullptr }; - NEReshapeLayer _reshape; - unsigned int _reduction_ops; - bool _keep_dims; + MemoryGroup _memory_group; + std::vector _reduction_kernels; + std::vector _reduced_outs; + NEReshapeLayer _reshape; + unsigned int _reduction_ops; + bool _keep_dims; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_NEON_REDUCE_MEAN_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NESplit.h b/arm_compute/runtime/NEON/functions/NESplit.h index 9f8aea41eb..06686a6665 100644 --- a/arm_compute/runtime/NEON/functions/NESplit.h +++ b/arm_compute/runtime/NEON/functions/NESplit.h @@ -68,9 +68,9 @@ public: void run() override; private: - std::vector _outputs_vector; - std::unique_ptr _slice_functions; - unsigned int _num_outputs; + std::vector _outputs_vector; + std::vector _slice_functions; + unsigned int _num_outputs; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_NESPLIT_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEStackLayer.h b/arm_compute/runtime/NEON/functions/NEStackLayer.h index 6032dae0cb..ba262371cd 100644 --- a/arm_compute/runtime/NEON/functions/NEStackLayer.h +++ b/arm_compute/runtime/NEON/functions/NEStackLayer.h @@ -73,9 +73,9 @@ public: void run() override; private: - std::vector _input; - std::unique_ptr _stack_kernels; - unsigned int _num_inputs; + std::vector _input; + std::vector _stack_kernels; + unsigned int _num_inputs; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_NESTACKLAYER_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEUnstack.h b/arm_compute/runtime/NEON/functions/NEUnstack.h index 7210afa914..4fd4a35039 100644 --- a/arm_compute/runtime/NEON/functions/NEUnstack.h +++ b/arm_compute/runtime/NEON/functions/NEUnstack.h @@ -68,8 +68,8 @@ public: void run() override; private: - unsigned int _num_slices; - std::unique_ptr _strided_slice_vector; + unsigned int _num_slices; + std::vector _strided_slice_vector; }; } // namespace arm_compute #endif /* __ARM_COMPUTE_NEUNSTACK_H__ */ diff --git a/arm_compute/runtime/NEON/functions/NEWidthConcatenateLayer.h b/arm_compute/runtime/NEON/functions/NEWidthConcatenateLayer.h index 0aaba7987f..8d221766cd 100644 --- a/arm_compute/runtime/NEON/functions/NEWidthConcatenateLayer.h +++ b/arm_compute/runtime/NEON/functions/NEWidthConcatenateLayer.h @@ -79,8 +79,8 @@ public: void run() override; private: - std::unique_ptr _concat_kernels_vector; - unsigned int _num_inputs; + std::vector _concat_kernels_vector; + unsigned int _num_inputs; template ::type, ITensor>::value)> void configure_internal(std::vector &&inputs_vector, ITensor *output); template ::type, ITensorInfo>::value)> diff --git a/arm_compute/runtime/Pyramid.h b/arm_compute/runtime/Pyramid.h index 2e7613759f..9efd6548ea 100644 --- a/arm_compute/runtime/Pyramid.h +++ b/arm_compute/runtime/Pyramid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -69,8 +69,8 @@ private: */ void internal_init(const PyramidInfo &info, bool auto_padding); - PyramidInfo _info{}; - std::unique_ptr _pyramid{ nullptr }; + PyramidInfo _info{}; + mutable std::vector _pyramid{}; }; } #endif /*__ARM_COMPUTE_PYRAMID_H__ */ diff --git a/examples/gc_absdiff.cpp b/examples/gc_absdiff.cpp index f53459231f..6793df040f 100644 --- a/examples/gc_absdiff.cpp +++ b/examples/gc_absdiff.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -40,7 +40,8 @@ class GCAbsDiffExample : public Example public: bool do_setup(int argc, char **argv) override { - PPMLoader ppm1, ppm2; + PPMLoader ppm1{}; + PPMLoader ppm2{}; GCScheduler::get().default_init(); if(argc < 2) diff --git a/examples/gc_dc.cpp b/examples/gc_dc.cpp index f3f194252e..6d09eba87c 100644 --- a/examples/gc_dc.cpp +++ b/examples/gc_dc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -81,7 +81,7 @@ public: Window window; window.use_tensor_dimensions(src_shape); Iterator it(&src, window); - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { *reinterpret_cast(it.ptr()) = half_float::half(1.f); }); diff --git a/examples/graph_deepspeech_v0_4_1.cpp b/examples/graph_deepspeech_v0_4_1.cpp index f280393e5d..a69d235944 100644 --- a/examples/graph_deepspeech_v0_4_1.cpp +++ b/examples/graph_deepspeech_v0_4_1.cpp @@ -308,19 +308,22 @@ private: graph.graph().add_connection(split_nid, 3, sigmoid_2_nid, 0); set_node_params(graph.graph(), sigmoid_2_nid, sigmoid_2_params); - SubStream mul_1_ss(graph); - mul_1_ss.forward_tail(sigmoid_1_nid); - mul_1_ss << EltwiseLayer(std::move(mul_1_ss), std::move(tanh_ss), EltwiseOperation::Mul) + SubStream sigmoid_1_ss(graph); + sigmoid_1_ss.forward_tail(sigmoid_1_nid); + SubStream mul_1_ss(sigmoid_1_ss); + mul_1_ss << EltwiseLayer(std::move(sigmoid_1_ss), std::move(tanh_ss), EltwiseOperation::Mul) .set_name(cell_name + "/mul_1"); - SubStream tanh_1_ss(graph); - tanh_1_ss.forward_tail(add_nid); - tanh_1_ss << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC)) - .set_name(cell_name + "/Sigmoid"); - tanh_1_ss << EltwiseLayer(std::move(tanh_1_ss), std::move(previous_state_c), EltwiseOperation::Mul) - .set_name(cell_name + "/mul"); + SubStream tanh_1_ss_tmp(graph); + tanh_1_ss_tmp.forward_tail(add_nid); - tanh_1_ss << EltwiseLayer(std::move(tanh_1_ss), std::move(mul_1_ss), EltwiseOperation::Add) + tanh_1_ss_tmp << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LOGISTIC)) + .set_name(cell_name + "/Sigmoid"); + SubStream tanh_1_ss_tmp2(tanh_1_ss_tmp); + tanh_1_ss_tmp2 << EltwiseLayer(std::move(tanh_1_ss_tmp), std::move(previous_state_c), EltwiseOperation::Mul) + .set_name(cell_name + "/mul"); + SubStream tanh_1_ss(tanh_1_ss_tmp2); + tanh_1_ss << EltwiseLayer(std::move(tanh_1_ss_tmp2), std::move(mul_1_ss), EltwiseOperation::Add) .set_name(cell_name + "/new_state_c"); SubStream new_state_c(tanh_1_ss); diff --git a/examples/neon_convolution.cpp b/examples/neon_convolution.cpp index 1a7e865908..56b4ddc0be 100644 --- a/examples/neon_convolution.cpp +++ b/examples/neon_convolution.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -32,7 +32,7 @@ using namespace utils; /** Gaussian 3x3 matrix */ -const int16_t gaussian3x3[] = +const std::array gaussian3x3 = { 1, 2, 1, 2, 4, 2, @@ -41,7 +41,7 @@ const int16_t gaussian3x3[] = /** Gaussian 5x5 matrix */ -const int16_t gaussian5x5[] = +const std::array gaussian5x5 = { 1, 4, 6, 4, 1, 4, 16, 24, 16, 4, @@ -79,8 +79,8 @@ public: // Apply a Gaussian 3x3 filter to the source image followed by a Gaussian 5x5: // The function will automatically update the padding information inside input and output to match its requirements - conv3x3.configure(&src, &tmp, gaussian3x3, 0 /* Let arm_compute calculate the scale */, BorderMode::UNDEFINED); - conv5x5.configure(&tmp, &dst, gaussian5x5, 0 /* Let arm_compute calculate the scale */, BorderMode::UNDEFINED); + conv3x3.configure(&src, &tmp, gaussian3x3.data(), 0 /* Let arm_compute calculate the scale */, BorderMode::UNDEFINED); + conv5x5.configure(&tmp, &dst, gaussian5x5.data(), 0 /* Let arm_compute calculate the scale */, BorderMode::UNDEFINED); // Now that the padding requirements are known we can allocate the images: src.allocator()->allocate(); diff --git a/examples/neon_sgemm.cpp b/examples/neon_sgemm.cpp index f6f93dd507..8f395dec9a 100644 --- a/examples/neon_sgemm.cpp +++ b/examples/neon_sgemm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -36,7 +36,9 @@ class NESGEMMExample : public Example public: bool do_setup(int argc, char **argv) override { - NPYLoader npy0, npy1, npy2; + NPYLoader npy0; + NPYLoader npy1; + NPYLoader npy2; alpha = 1.0f; beta = 0.0f; diff --git a/scripts/clang_tidy_rules.py b/scripts/clang_tidy_rules.py index d35273d545..cba226f5d7 100755 --- a/scripts/clang_tidy_rules.py +++ b/scripts/clang_tidy_rules.py @@ -42,6 +42,9 @@ def filter_clang_tidy_lines( lines ): if "/convolution/" in line: continue + if "/validate_examples/" in line: + continue + if "error:" in line: if (("Utils.cpp" in line and "'arm_compute_version.embed' file not found" in line) or ("arm_fp16.h" in line) or @@ -62,11 +65,14 @@ def filter_clang_tidy_lines( lines ): elif "warning:" in line: if ("uninitialized record type: '__ret'" in line or "local variable '__bound_functor' is still referred to by the global variable '__once_callable'" in line or + "assigning newly created 'gsl::owner<>'" in line or (any(f in line for f in ["Error.cpp","Error.h"]) and "thrown exception type is not nothrow copy constructible" in line) or (any(f in line for f in ["Error.cpp","Error.h"]) and "uninitialized record type: 'args'" in line) or (any(f in line for f in ["Error.cpp","Error.h"]) and "do not call c-style vararg functions" in line) or (any(f in line for f in ["Error.cpp","Error.h"]) and "do not define a C-style variadic function" in line) or ("TensorAllocator.cpp" in line and "warning: pointer parameter 'ptr' can be pointer to const" in line) or + ("TensorAllocator.cpp" in line and "warning: do not declare C-style arrays" in line) or + ("RawTensor.cpp" in line and "warning: pointer parameter 'ptr' can be pointer to const" in line) or ("NEMinMaxLocationKernel.cpp" in line and "move constructors should be marked noexcept" in line) or ("NEMinMaxLocationKernel.cpp" in line and "move assignment operators should be marked noexcept" in line) or ("CLMinMaxLocationKernel.cpp" in line and "Forming reference to null pointer" in line) or @@ -95,6 +101,8 @@ def filter_clang_tidy_lines( lines ): ("CPUUtils.cpp" in line and "consider replacing 'unsigned long' with 'uint64'" in line) or ("CPUUtils.cpp" in line and "parameter 'cpusv' is unused" in line) or ("CPUUtils.cpp" in line and "warning: uninitialized record type" in line) or + ("GCKernelLibrary.cpp" in line and "warning: do not declare C-style arrays" in line) or + ("Utils.h" in line and "warning: Use of zero-allocated memory" in line) or "3rdparty" in line): print_context=False continue diff --git a/src/core/AccessWindowAutoPadding.cpp b/src/core/AccessWindowAutoPadding.cpp index 74af99bbb9..cfb36e1da1 100644 --- a/src/core/AccessWindowAutoPadding.cpp +++ b/src/core/AccessWindowAutoPadding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -47,10 +47,10 @@ ValidRegion AccessWindowAutoPadding::compute_valid_region() const { if(_info == nullptr) { - return ValidRegion(); + return ValidRegion{}; } - return ValidRegion(Coordinates(), _info->tensor_shape()); + return ValidRegion{ Coordinates(), _info->tensor_shape() }; } void AccessWindowAutoPadding::set_valid_region() diff --git a/src/core/CL/kernels/CLComparisonKernel.cpp b/src/core/CL/kernels/CLComparisonKernel.cpp index f5f5a0fbd6..4f44851ef8 100644 --- a/src/core/CL/kernels/CLComparisonKernel.cpp +++ b/src/core/CL/kernels/CLComparisonKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -219,6 +219,6 @@ BorderSize CLComparisonKernel::border_size() const const unsigned int replicateSize = _output->info()->dimension(0) - std::min(_input1->info()->dimension(0), _input2->info()->dimension(0)); const unsigned int border = std::min(num_elems_processed_per_iteration - 1U, replicateSize); - return BorderSize(0, border, 0, 0); + return BorderSize{ 0, border, 0, 0 }; } } // namespace arm_compute diff --git a/src/core/CL/kernels/CLElementwiseOperationKernel.cpp b/src/core/CL/kernels/CLElementwiseOperationKernel.cpp index 37eeeb78bf..63c9244961 100644 --- a/src/core/CL/kernels/CLElementwiseOperationKernel.cpp +++ b/src/core/CL/kernels/CLElementwiseOperationKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -281,7 +281,7 @@ BorderSize CLElementwiseOperationKernel::border_size() const { const unsigned int replicateSize = _output->info()->dimension(0) - std::min(_input1->info()->dimension(0), _input2->info()->dimension(0)); const unsigned int border = std::min(num_elems_processed_per_iteration - 1U, replicateSize); - return BorderSize(0, border, 0, 0); + return BorderSize{ 0, border, 0, 0 }; } /** Arithmetic operations with saturation*/ diff --git a/src/core/CL/kernels/CLGaussian5x5Kernel.cpp b/src/core/CL/kernels/CLGaussian5x5Kernel.cpp index bd523c883d..3b45b07ed9 100644 --- a/src/core/CL/kernels/CLGaussian5x5Kernel.cpp +++ b/src/core/CL/kernels/CLGaussian5x5Kernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -29,17 +29,17 @@ using namespace arm_compute; void CLGaussian5x5HorKernel::configure(const ICLTensor *input, ICLTensor *output, bool border_undefined) { - const int16_t matrix[] = { 1, 4, 6, 4, 1 }; + const std::array matrix = { 1, 4, 6, 4, 1 }; // Set arguments - CLSeparableConvolution5x5HorKernel::configure(input, output, matrix, border_undefined); + CLSeparableConvolution5x5HorKernel::configure(input, output, matrix.data(), border_undefined); } void CLGaussian5x5VertKernel::configure(const ICLTensor *input, ICLTensor *output, bool border_undefined) { - const uint32_t scale = 256; - const int16_t matrix[] = { 1, 4, 6, 4, 1 }; + const uint32_t scale = 256; + const std::array matrix = { 1, 4, 6, 4, 1 }; // Set arguments - CLSeparableConvolution5x5VertKernel::configure(input, output, matrix, scale, border_undefined); + CLSeparableConvolution5x5VertKernel::configure(input, output, matrix.data(), scale, border_undefined); } diff --git a/src/core/CL/kernels/CLGaussianPyramidKernel.cpp b/src/core/CL/kernels/CLGaussianPyramidKernel.cpp index 6b729c8585..c9c7bf39a9 100644 --- a/src/core/CL/kernels/CLGaussianPyramidKernel.cpp +++ b/src/core/CL/kernels/CLGaussianPyramidKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -38,7 +38,7 @@ CLGaussianPyramidHorKernel::CLGaussianPyramidHorKernel() BorderSize CLGaussianPyramidHorKernel::border_size() const { - return BorderSize(0, 2); + return BorderSize{ 0, 2 }; } void CLGaussianPyramidHorKernel::configure(const ICLTensor *input, ICLTensor *output) @@ -130,7 +130,7 @@ CLGaussianPyramidVertKernel::CLGaussianPyramidVertKernel() BorderSize CLGaussianPyramidVertKernel::border_size() const { - return BorderSize(2, 0); + return BorderSize{ 2, 0 }; } void CLGaussianPyramidVertKernel::configure(const ICLTensor *input, ICLTensor *output) diff --git a/src/core/CL/kernels/CLMinMaxLayerKernel.cpp b/src/core/CL/kernels/CLMinMaxLayerKernel.cpp index fa7b678e86..92b5f8d505 100644 --- a/src/core/CL/kernels/CLMinMaxLayerKernel.cpp +++ b/src/core/CL/kernels/CLMinMaxLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -127,7 +127,7 @@ void CLMinMaxLayerKernel::reset(cl::CommandQueue &queue) Iterator output(_output, window_output); // Reset output - execute_window_loop(window_output, [&](const Coordinates & id) + execute_window_loop(window_output, [&](const Coordinates &) { auto *ptr = reinterpret_cast(output.ptr()); ptr[0] = std::numeric_limits::max(); diff --git a/src/core/CPP/kernels/CPPUpsampleKernel.cpp b/src/core/CPP/kernels/CPPUpsampleKernel.cpp index f04728d30d..d29c0f72f1 100644 --- a/src/core/CPP/kernels/CPPUpsampleKernel.cpp +++ b/src/core/CPP/kernels/CPPUpsampleKernel.cpp @@ -94,7 +94,7 @@ void CPPUpsampleKernel::run(const Window &window, const ThreadInfo &info) Iterator in(_input, window); Iterator out(_output, window_out); - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { memcpy(out.ptr(), in.ptr(), element_size); }, diff --git a/src/core/Error.cpp b/src/core/Error.cpp index e7b43655a2..45cce66804 100644 --- a/src/core/Error.cpp +++ b/src/core/Error.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -23,6 +23,7 @@ */ #include "arm_compute/core/Error.h" +#include #include #include #include @@ -32,11 +33,11 @@ using namespace arm_compute; Status arm_compute::create_error_va_list(ErrorCode error_code, const char *function, const char *file, const int line, const char *msg, va_list args) { - char out[512]; - int offset = snprintf(out, sizeof(out), "in %s %s:%d: ", function, file, line); - vsnprintf(out + offset, sizeof(out) - offset, msg, args); + std::array out{ 0 }; + int offset = snprintf(out.data(), out.size(), "in %s %s:%d: ", function, file, line); + vsnprintf(out.data() + offset, out.size() - offset, msg, args); - return Status(error_code, std::string(out)); + return Status(error_code, std::string(out.data())); } Status arm_compute::create_error(ErrorCode error_code, const char *function, const char *file, const int line, const char *msg, ...) diff --git a/src/core/GLES_COMPUTE/GCKernelLibrary.cpp b/src/core/GLES_COMPUTE/GCKernelLibrary.cpp index 25ac02e8f4..0af8c7d4cc 100644 --- a/src/core/GLES_COMPUTE/GCKernelLibrary.cpp +++ b/src/core/GLES_COMPUTE/GCKernelLibrary.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -387,7 +387,7 @@ GCKernel GCKernelLibrary::create_kernel(const std::string &shader_name, const St return kernel; } -const std::string GCKernelLibrary::preprocess_shader(const std::string &shader_source) const +std::string GCKernelLibrary::preprocess_shader(const std::string &shader_source) const { enum class ParserStage { @@ -399,7 +399,7 @@ const std::string GCKernelLibrary::preprocess_shader(const std::string &shader_s // Define a GLES compute shader parser function std::function cs_parser; - cs_parser = [&](const std::string & src, ParserStage stage, int nested_level) -> std::string + cs_parser = [&](const std::string & src, ParserStage stage, int) -> std::string { std::string dst; diff --git a/src/core/GLES_COMPUTE/kernels/GCPoolingLayerKernel.cpp b/src/core/GLES_COMPUTE/kernels/GCPoolingLayerKernel.cpp index f225ebde6b..50171a1015 100644 --- a/src/core/GLES_COMPUTE/kernels/GCPoolingLayerKernel.cpp +++ b/src/core/GLES_COMPUTE/kernels/GCPoolingLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -333,7 +333,10 @@ void GCPoolingLayerKernel::run(const Window &window) ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(IKernel::window(), window); - unsigned int pool_pad_x, pool_pad_y, pool_stride_x, pool_stride_y = 0; + unsigned int pool_pad_x; + unsigned int pool_pad_y; + unsigned int pool_stride_x; + unsigned int pool_stride_y; std::tie(pool_pad_x, pool_pad_y) = _pool_info.pad_stride_info().pad(); std::tie(pool_stride_x, pool_stride_y) = _pool_info.pad_stride_info().stride(); diff --git a/src/core/NEON/kernels/NECropKernel.cpp b/src/core/NEON/kernels/NECropKernel.cpp index b6fe5819e4..f16eb3e6bd 100644 --- a/src/core/NEON/kernels/NECropKernel.cpp +++ b/src/core/NEON/kernels/NECropKernel.cpp @@ -178,7 +178,7 @@ inline void out_of_bounds_crop_window(const ITensor *output, float *output_ptr, template inline void execute_window(const ITensor *input, const ITensor *output, Coordinates input_offset, float extrapolation_value, - const uint32_t rows_out_of_bounds[], const uint32_t cols_out_of_bounds[], NECropKernel::InBoundsCropFunction *in_bounds_crop_function) + const std::array &rows_out_of_bounds, const std::array &cols_out_of_bounds, NECropKernel::InBoundsCropFunction *in_bounds_crop_function) { // Output is always float. const int window_step_x = 16 / sizeof(float); diff --git a/src/core/NEON/kernels/NEDilateKernel.cpp b/src/core/NEON/kernels/NEDilateKernel.cpp index 3ee00a47d3..e761815f9e 100644 --- a/src/core/NEON/kernels/NEDilateKernel.cpp +++ b/src/core/NEON/kernels/NEDilateKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -94,7 +94,8 @@ void NEDilateKernel::run(const Window &window, const ThreadInfo &info) uint8x8_t bot_high_data = vget_high_u8(bot_data); uint8x8_t bot_low_data = vget_low_u8(bot_data); - uint8x8_t p0, p1; + uint8x8_t p0; + uint8x8_t p1; p0 = top_low_data; p1 = vext_u8(top_low_data, top_high_data, 1); diff --git a/src/core/NEON/kernels/NEDirectConvolutionLayerKernel.cpp b/src/core/NEON/kernels/NEDirectConvolutionLayerKernel.cpp index 162c4b1ace..d557cfa1bd 100644 --- a/src/core/NEON/kernels/NEDirectConvolutionLayerKernel.cpp +++ b/src/core/NEON/kernels/NEDirectConvolutionLayerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -192,12 +192,12 @@ public: execute_window_loop(window_out, [&](const Coordinates & id) { - const uint8_t *input_ptr = in.ptr() - conv_pad_left * input_stride_x - conv_pad_top * input_stride_y; - uint8_t *out_ptr = out.ptr(); - int ih = 0; - int oh = 0; - float32x4_t accum0[small_tensor_size_optim] = { vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0) }; - float32x4_t accum1[small_tensor_size_optim] = { vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0) }; + const uint8_t *input_ptr = in.ptr() - conv_pad_left * input_stride_x - conv_pad_top * input_stride_y; + uint8_t *out_ptr = out.ptr(); + int ih = 0; + int oh = 0; + std::array accum0 = { vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0) }; + std::array accum1 = { vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0), vdupq_n_f32(0) }; for(int oz = 0; oz < range_z; ++oz) { accum0[0] = accum0[1] = accum0[2] = accum0[3] = accum0[4] = accum0[5] = accum0[6] = accum0[7] = vdupq_n_f32(0.f); diff --git a/src/core/NEON/kernels/NEErodeKernel.cpp b/src/core/NEON/kernels/NEErodeKernel.cpp index 88c20f8174..2a538ecd0f 100644 --- a/src/core/NEON/kernels/NEErodeKernel.cpp +++ b/src/core/NEON/kernels/NEErodeKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -94,7 +94,8 @@ void NEErodeKernel::run(const Window &window, const ThreadInfo &info) uint8x8_t bot_high_data = vget_high_u8(bot_data); uint8x8_t bot_low_data = vget_low_u8(bot_data); - uint8x8_t p0, p1; + uint8x8_t p0; + uint8x8_t p1; p0 = top_low_data; p1 = vext_u8(top_low_data, top_high_data, 1); diff --git a/src/core/NEON/kernels/NEFillBorderKernel.cpp b/src/core/NEON/kernels/NEFillBorderKernel.cpp index f4046e0851..4127dc8fbd 100644 --- a/src/core/NEON/kernels/NEFillBorderKernel.cpp +++ b/src/core/NEON/kernels/NEFillBorderKernel.cpp @@ -168,7 +168,7 @@ void NEFillBorderKernel::fill_replicate_single_channel(const Window &window) Iterator vertical_it(_tensor, vertical); - execute_window_loop(vertical, [&](const Coordinates & id) + execute_window_loop(vertical, [&](const Coordinates &) { uint8_t *base_addr = start_valid_region + vertical_it.offset(); // Fill left and right borders @@ -188,7 +188,7 @@ void NEFillBorderKernel::fill_replicate_single_channel(const Window &window) Iterator plane_it(_tensor, window); // Iterate over all XY planes - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { uint8_t *base_addr = start_valid_region + plane_it.offset(); // Top border @@ -224,7 +224,7 @@ void NEFillBorderKernel::fill_constant_value_single_channel(const Window &window Iterator vertical_it(_tensor, vertical); - execute_window_loop(vertical, [&](const Coordinates & id) + execute_window_loop(vertical, [&](const Coordinates &) { uint8_t *base_addr = start_valid_region + vertical_it.offset(); // Fill left and right borders @@ -244,7 +244,7 @@ void NEFillBorderKernel::fill_constant_value_single_channel(const Window &window Iterator plane_it(_tensor, window); // Iterate over all XY planes - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { uint8_t *base_addr = start_valid_region + plane_it.offset(); // Top border diff --git a/src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.cpp b/src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.cpp index 7769d9eb8c..c929983162 100644 --- a/src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.cpp +++ b/src/core/NEON/kernels/NEGEMMInterleave4x4Kernel.cpp @@ -126,7 +126,7 @@ void gemm_interleave_16bit_elements(const ITensor *input, ITensor *output, const win_out.set_dimension_step(Window::DimX, 16); Iterator out(output, win_out); - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { const uint16x4x4_t data = { @@ -154,7 +154,7 @@ void gemm_interleave_32bit_elements(const ITensor *input, ITensor *output, const win_out.set_dimension_step(Window::DimX, 16); Iterator out(output, win_out); - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { const uint32x4x4_t data = { diff --git a/src/core/NEON/kernels/NELKTrackerKernel.cpp b/src/core/NEON/kernels/NELKTrackerKernel.cpp index 83593e7f0d..ddf869e303 100644 --- a/src/core/NEON/kernels/NELKTrackerKernel.cpp +++ b/src/core/NEON/kernels/NELKTrackerKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -405,9 +405,9 @@ void NELKTrackerKernel::run(const Window &window, const ThreadInfo &info) init_keypoints(list_start, list_end); - const int buffer_size = _window_dimension * _window_dimension; - int32_t bilinear_ix[buffer_size]; - int32_t bilinear_iy[buffer_size]; + const int buffer_size = _window_dimension * _window_dimension; + std::vector bilinear_ix(buffer_size); + std::vector bilinear_iy(buffer_size); const int half_window = _window_dimension / 2; @@ -444,7 +444,7 @@ void NELKTrackerKernel::run(const Window &window, const ThreadInfo &info) int iA12 = 0; int iA22 = 0; - std::tie(iA11, iA12, iA22) = compute_spatial_gradient_matrix(old_keypoint, bilinear_ix, bilinear_iy); + std::tie(iA11, iA12, iA22) = compute_spatial_gradient_matrix(old_keypoint, bilinear_ix.data(), bilinear_iy.data()); const float A11 = iA11 * FLT_SCALE; const float A12 = iA12 * FLT_SCALE; @@ -490,7 +490,7 @@ void NELKTrackerKernel::run(const Window &window, const ThreadInfo &info) int ib1 = 0; int ib2 = 0; - std::tie(ib1, ib2) = compute_image_mismatch_vector(old_keypoint, new_keypoint, bilinear_ix, bilinear_iy); + std::tie(ib1, ib2) = compute_image_mismatch_vector(old_keypoint, new_keypoint, bilinear_ix.data(), bilinear_iy.data()); double b1 = ib1 * FLT_SCALE; double b2 = ib2 * FLT_SCALE; diff --git a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp index 0b90d9f290..ac2ffa1988 100644 --- a/src/core/NEON/kernels/NEPoolingLayerKernel.cpp +++ b/src/core/NEON/kernels/NEPoolingLayerKernel.cpp @@ -352,7 +352,8 @@ void NEPoolingLayerKernel::configure(const ITensor *input, ITensor *output, cons ARM_COMPUTE_ERROR_THROW_ON(validate_arguments_pool_info(pool_size.x(), pool_size.y())); // Check output dimensions - unsigned int pooled_w, pooled_h; + unsigned int pooled_w; + unsigned int pooled_h; std::tie(pooled_w, pooled_h) = scaled_dimensions(input->info()->dimension(idx_width), input->info()->dimension(idx_height), pool_size.x(), diff --git a/src/core/NEON/kernels/NERemapKernel.cpp b/src/core/NEON/kernels/NERemapKernel.cpp index edb3ffe1df..3c871de73a 100644 --- a/src/core/NEON/kernels/NERemapKernel.cpp +++ b/src/core/NEON/kernels/NERemapKernel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -113,8 +113,8 @@ void NERemapKernel::configure(const ITensor *input, const ITensor *map_x, const AccessWindowStatic input_access(input->info(), -border_size().left, -border_size().top, access_right, input->info()->dimension(1) + border_size().bottom); AccessWindowHorizontal output_access(output->info(), 0, num_elems_processed_per_iteration); - AccessWindowHorizontal mapx_access(map_x->info(), 0, num_elems_processed_per_iteration); - AccessWindowHorizontal mapy_access(map_y->info(), 0, num_elems_processed_per_iteration); + AccessWindowHorizontal mapx_access(map_x->info(), 0, num_elems_processed_per_iteration); + AccessWindowHorizontal mapy_access(map_y->info(), 0, num_elems_processed_per_iteration); update_window_and_padding(win, input_access, mapx_access, mapy_access, output_access); @@ -140,7 +140,7 @@ void NERemapKernel::remap_nearest(const Window &window) const float32x4_t height = vdupq_n_f32(static_cast(_input->info()->dimension(1))); const int32x4_t in_stride = vdupq_n_s32(static_cast(_input->info()->strides_in_bytes()[1])); - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { const auto mapx_ptr = reinterpret_cast(mapx.ptr()); const auto mapy_ptr = reinterpret_cast(mapy.ptr()); @@ -190,7 +190,7 @@ void NERemapKernel::remap_bilinear(const Window &window) const size_t height = _input->info()->dimension(1); const size_t in_stride = _input->info()->strides_in_bytes()[1]; - execute_window_loop(window, [&](const Coordinates & id) + execute_window_loop(window, [&](const Coordinates &) { const auto mapx_ptr = reinterpret_cast(mapx.ptr()); const auto mapy_ptr = reinterpret_cast(mapy.ptr()); diff --git a/src/core/NEON/kernels/NEScaleKernel.cpp b/src/core/NEON/kernels/NEScaleKernel.cpp index 8c4a70cdad..33540393e4 100644 --- a/src/core/NEON/kernels/NEScaleKernel.cpp +++ b/src/core/NEON/kernels/NEScaleKernel.cpp @@ -249,7 +249,10 @@ inline void scale_bilinear_nhwc_core(const ITensor *input, const ITensor *offset if(is_valid(offset, -border_size, input_width - 1 + border_size, in_yi, -border_size, input_height - 1 + border_size)) { - T a00 = 0, a01 = 0, a10 = 0, a11 = 0; + T a00 = 0; + T a01 = 0; + T a10 = 0; + T a11 = 0; if(border_mode == BorderMode::CONSTANT) { diff --git a/src/core/utils/helpers/tensor_transform.cpp b/src/core/utils/helpers/tensor_transform.cpp index 7c56390fed..f6a54a59ee 100644 --- a/src/core/utils/helpers/tensor_transform.cpp +++ b/src/core/utils/helpers/tensor_transform.cpp @@ -117,6 +117,7 @@ std::tuple calculate_strided_slice_coords Coordinates starts_abs{}; Coordinates ends_abs{}; Coordinates final_strides{}; + for(unsigned int i = 0; i < input_shape.num_dimensions(); ++i) { const int start_i = calculate_start_on_index(input_shape, i, starts, strides, begin_mask); diff --git a/src/core/utils/logging/LoggerRegistry.cpp b/src/core/utils/logging/LoggerRegistry.cpp index 3a466963fd..055e770c75 100644 --- a/src/core/utils/logging/LoggerRegistry.cpp +++ b/src/core/utils/logging/LoggerRegistry.cpp @@ -42,12 +42,12 @@ LoggerRegistry &LoggerRegistry::get() return _instance; } -void LoggerRegistry::create_logger(const std::string &name, LogLevel log_level, std::vector> printers) +void LoggerRegistry::create_logger(const std::string &name, LogLevel log_level, const std::vector> &printers) { std::lock_guard lock(_mtx); if((_loggers.find(name) == _loggers.end()) && (_reserved_loggers.find(name) == _reserved_loggers.end())) { - _loggers[name] = std::make_shared(name, log_level, std::move(printers)); + _loggers[name] = std::make_shared(name, log_level, printers); } } diff --git a/src/runtime/BlobLifetimeManager.cpp b/src/runtime/BlobLifetimeManager.cpp index c5d42b1be1..1323bb3f8c 100644 --- a/src/runtime/BlobLifetimeManager.cpp +++ b/src/runtime/BlobLifetimeManager.cpp @@ -66,7 +66,7 @@ void BlobLifetimeManager::update_blobs_and_mappings() std::vector group_sizes; std::transform(std::begin(_free_blobs), std::end(_free_blobs), std::back_inserter(group_sizes), [](const Blob & b) { - return BlobInfo(b.max_size, b.max_alignment); + return BlobInfo{ b.max_size, b.max_alignment }; }); // Update blob sizes @@ -75,7 +75,7 @@ void BlobLifetimeManager::update_blobs_and_mappings() group_sizes.resize(max_size); std::transform(std::begin(_blobs), std::end(_blobs), std::begin(group_sizes), std::begin(_blobs), [](BlobInfo lhs, BlobInfo rhs) { - return BlobInfo(std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment)); + return BlobInfo{ std::max(lhs.size, rhs.size), std::max(lhs.alignment, rhs.alignment) }; }); // Calculate group mappings diff --git a/src/runtime/CL/CLHelpers.cpp b/src/runtime/CL/CLHelpers.cpp index 533e6fabfa..8bc7b8eb7b 100644 --- a/src/runtime/CL/CLHelpers.cpp +++ b/src/runtime/CL/CLHelpers.cpp @@ -47,7 +47,7 @@ void printf_callback(const char *buffer, unsigned int len, size_t complete, void * @return A pointer to the context properties which can be used to create an opencl context */ -void initialise_context_properties(const cl::Platform &platform, const cl::Device &device, cl_context_properties prop[7]) +void initialise_context_properties(const cl::Platform &platform, const cl::Device &device, std::array &prop) { ARM_COMPUTE_UNUSED(device); #if defined(ARM_COMPUTE_ASSERTS_ENABLED) @@ -55,7 +55,7 @@ void initialise_context_properties(const cl::Platform &platform, const cl::Devic if(arm_compute::device_supports_extension(device, "cl_arm_printf")) { // Create a cl_context with a printf_callback and user specified buffer size. - cl_context_properties properties_printf[] = + std::array properties_printf = { CL_CONTEXT_PLATFORM, reinterpret_cast(platform()), // Enable a printf callback function for this context. @@ -65,17 +65,17 @@ void initialise_context_properties(const cl::Platform &platform, const cl::Devic CL_PRINTF_BUFFERSIZE_ARM, 0x1000, 0 }; - std::copy_n(properties_printf, 7, prop); + prop = properties_printf; } else #endif // defined(ARM_COMPUTE_ASSERTS_ENABLED) { - cl_context_properties properties[] = + std::array properties = { CL_CONTEXT_PLATFORM, reinterpret_cast(platform()), 0 }; - std::copy_n(properties, 3, prop); + std::copy(properties.begin(), properties.end(), prop.begin()); }; } } //namespace @@ -94,11 +94,11 @@ create_opencl_context_and_device() std::vector platform_devices; p.getDevices(CL_DEVICE_TYPE_DEFAULT, &platform_devices); ARM_COMPUTE_ERROR_ON_MSG(platform_devices.size() == 0, "Couldn't find any OpenCL device"); - device = platform_devices[0]; - cl_int err = CL_SUCCESS; - cl_context_properties properties[7] = { 0, 0, 0, 0, 0, 0, 0 }; + device = platform_devices[0]; + cl_int err = CL_SUCCESS; + std::array properties = { 0, 0, 0, 0, 0, 0, 0 }; initialise_context_properties(p, device, properties); - cl::Context cl_context = cl::Context(device, properties, nullptr, nullptr, &err); + cl::Context cl_context = cl::Context(device, properties.data(), nullptr, nullptr, &err); ARM_COMPUTE_ERROR_ON_MSG(err != CL_SUCCESS, "Failed to create OpenCL context"); return std::make_tuple(cl_context, device, err); } diff --git a/src/runtime/CL/CLMemory.cpp b/src/runtime/CL/CLMemory.cpp index 5bea85cfae..557378b6f1 100644 --- a/src/runtime/CL/CLMemory.cpp +++ b/src/runtime/CL/CLMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,8 +33,8 @@ CLMemory::CLMemory() { } -CLMemory::CLMemory(std::shared_ptr memory) - : _region(nullptr), _region_owned(std::move(memory)) +CLMemory::CLMemory(const std::shared_ptr &memory) + : _region(nullptr), _region_owned(memory) { _region_owned = memory; _region = _region_owned.get(); diff --git a/src/runtime/CL/CLMultiHOG.cpp b/src/runtime/CL/CLMultiHOG.cpp index 88d45acd12..2577ec08ac 100644 --- a/src/runtime/CL/CLMultiHOG.cpp +++ b/src/runtime/CL/CLMultiHOG.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -30,8 +30,9 @@ using namespace arm_compute; CLMultiHOG::CLMultiHOG(size_t num_models) - : _num_models(num_models), _model(arm_compute::support::cpp14::make_unique(_num_models)) + : _num_models(num_models), _model() { + _model.resize(_num_models); } size_t CLMultiHOG::num_models() const @@ -42,11 +43,11 @@ size_t CLMultiHOG::num_models() const ICLHOG *CLMultiHOG::cl_model(size_t index) { ARM_COMPUTE_ERROR_ON(index >= _num_models); - return (_model.get() + index); + return (&_model[index]); } const ICLHOG *CLMultiHOG::cl_model(size_t index) const { ARM_COMPUTE_ERROR_ON(index >= _num_models); - return (_model.get() + index); + return (&_model[index]); } \ No newline at end of file diff --git a/src/runtime/CL/CLPyramid.cpp b/src/runtime/CL/CLPyramid.cpp index 865f389f7f..6d5dba0031 100644 --- a/src/runtime/CL/CLPyramid.cpp +++ b/src/runtime/CL/CLPyramid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -35,7 +35,7 @@ using namespace arm_compute; CLPyramid::CLPyramid() - : _info(), _pyramid(nullptr) + : _info(), _pyramid() { } @@ -51,8 +51,8 @@ void CLPyramid::init_auto_padding(const PyramidInfo &info) void CLPyramid::internal_init(const PyramidInfo &info, bool auto_padding) { - _info = info; - _pyramid = arm_compute::support::cpp14::make_unique(_info.num_levels()); + _info = info; + _pyramid.resize(_info.num_levels()); size_t w = _info.width(); size_t h = _info.height(); @@ -109,11 +109,9 @@ void CLPyramid::internal_init(const PyramidInfo &info, bool auto_padding) void CLPyramid::allocate() { - ARM_COMPUTE_ERROR_ON(_pyramid == nullptr); - for(size_t i = 0; i < _info.num_levels(); ++i) { - (_pyramid.get() + i)->allocator()->allocate(); + _pyramid[i].allocator()->allocate(); } } @@ -126,5 +124,5 @@ CLTensor *CLPyramid::get_pyramid_level(size_t index) const { ARM_COMPUTE_ERROR_ON(index >= _info.num_levels()); - return (_pyramid.get() + index); + return &_pyramid[index]; } diff --git a/src/runtime/CL/CLTensorAllocator.cpp b/src/runtime/CL/CLTensorAllocator.cpp index 2ce64551ae..101e4f1cd4 100644 --- a/src/runtime/CL/CLTensorAllocator.cpp +++ b/src/runtime/CL/CLTensorAllocator.cpp @@ -34,7 +34,7 @@ const cl::Buffer CLTensorAllocator::_empty_buffer = cl::Buffer(); namespace { -std::unique_ptr allocate_region(cl::Context context, size_t size, cl_uint alignment) +std::unique_ptr allocate_region(const cl::Context &context, size_t size, cl_uint alignment) { // Try fine-grain SVM std::unique_ptr region = support::cpp14::make_unique(context, diff --git a/src/runtime/CL/CLTuner.cpp b/src/runtime/CL/CLTuner.cpp index 8f8d3e7c3a..929def24cc 100644 --- a/src/runtime/CL/CLTuner.cpp +++ b/src/runtime/CL/CLTuner.cpp @@ -275,7 +275,7 @@ void CLTuner::save_to_file(const std::string &filename) const std::ofstream fs; fs.exceptions(std::ifstream::failbit | std::ifstream::badbit); fs.open(filename, std::ios::out); - for(auto kernel_data : _lws_table) + for(auto const &kernel_data : _lws_table) { fs << kernel_data.first << ";" << kernel_data.second[0] << ";" << kernel_data.second[1] << ";" << kernel_data.second[2] << std::endl; } diff --git a/src/runtime/CL/functions/CLConvolution.cpp b/src/runtime/CL/functions/CLConvolution.cpp index 2f43ce1974..f09585e7ec 100644 --- a/src/runtime/CL/functions/CLConvolution.cpp +++ b/src/runtime/CL/functions/CLConvolution.cpp @@ -58,13 +58,13 @@ void CLConvolutionSquare::configure(ICLTensor *input, ICLTensor *ou { ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::U8); ARM_COMPUTE_ERROR_ON(conv == nullptr); - int16_t conv_col[matrix_size]; - int16_t conv_row[matrix_size]; - _is_separable = separate_matrix(conv, conv_col, conv_row, matrix_size); + std::array conv_col{ 0 }; + std::array conv_row{ 0 }; + _is_separable = separate_matrix(conv, conv_col.data(), conv_row.data(), matrix_size); if(_is_separable) { - std::pair type_pair = data_type_for_convolution(conv_col, conv_row, matrix_size); + std::pair type_pair = data_type_for_convolution(conv_col.data(), conv_row.data(), matrix_size); _tmp.allocator()->init(TensorInfo(input->info()->tensor_shape(), 1, type_pair.first)); // Manage intermediate buffers @@ -75,8 +75,8 @@ void CLConvolutionSquare::configure(ICLTensor *input, ICLTensor *ou scale = calculate_matrix_scale(conv, matrix_size); } - _kernel_hor.configure(input, &_tmp, conv_row, border_mode == BorderMode::UNDEFINED); - _kernel_vert.configure(&_tmp, output, conv_col, scale, border_mode == BorderMode::UNDEFINED, type_pair.second); + _kernel_hor.configure(input, &_tmp, conv_row.data(), border_mode == BorderMode::UNDEFINED); + _kernel_vert.configure(&_tmp, output, conv_col.data(), scale, border_mode == BorderMode::UNDEFINED, type_pair.second); _border_handler.configure(input, _kernel_hor.border_size(), border_mode, PixelValue(constant_border_value)); // Allocate intermediate buffer diff --git a/src/runtime/CL/functions/CLDepthConcatenateLayer.cpp b/src/runtime/CL/functions/CLDepthConcatenateLayer.cpp index 4a5f845631..f687e54552 100644 --- a/src/runtime/CL/functions/CLDepthConcatenateLayer.cpp +++ b/src/runtime/CL/functions/CLDepthConcatenateLayer.cpp @@ -36,8 +36,7 @@ using namespace arm_compute; CLDepthConcatenateLayer::CLDepthConcatenateLayer() // NOLINT - : _inputs_vector(), - _concat_kernels_vector(), + : _concat_kernels_vector(), _border_handlers_vector(), _num_inputs(0) { @@ -53,8 +52,8 @@ void CLDepthConcatenateLayer::configure(const std::vector &inputs_v inputs_vector_info.emplace_back(inputs_vector.at(i)->info()); } - _concat_kernels_vector = arm_compute::support::cpp14::make_unique(_num_inputs); - _border_handlers_vector = arm_compute::support::cpp14::make_unique(_num_inputs); + _concat_kernels_vector.resize(_num_inputs); + _border_handlers_vector.resize(_num_inputs); TensorShape output_shape = arm_compute::misc::shape_calculator::calculate_concatenate_shape(inputs_vector_info, Window::DimZ); diff --git a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp index 8211104bda..97b0a01331 100644 --- a/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLDepthwiseConvolutionLayer.cpp @@ -322,7 +322,8 @@ void CLDepthwiseConvolutionLayer::configure(ICLTensor *input, const ICLTensor *w const QuantizationInfo output_quant_info = (output->info()->total_size() == 0) ? input->info()->quantization_info() : output->info()->quantization_info(); float multiplier = input->info()->quantization_info().scale * weights->info()->quantization_info().scale / output_quant_info.scale; - int output_multiplier, output_shift; + int output_multiplier; + int output_shift; quantization::calculate_quantized_multiplier_less_than_one(multiplier, &output_multiplier, &output_shift); _output_stage_kernel.configure(&_output_reshaped, biases, output, output_multiplier, output_shift, output_quant_info.offset); _output_reshaped.allocator()->allocate(); diff --git a/src/runtime/CL/functions/CLFFT1D.cpp b/src/runtime/CL/functions/CLFFT1D.cpp index 67111e7e5c..49b5a2a2e6 100644 --- a/src/runtime/CL/functions/CLFFT1D.cpp +++ b/src/runtime/CL/functions/CLFFT1D.cpp @@ -62,7 +62,7 @@ void CLFFT1D::configure(const ICLTensor *input, ICLTensor *output, const FFT1DIn // Create and configure FFT kernels unsigned int Nx = 1; _num_ffts = decomposed_vector.size(); - _fft_kernels = arm_compute::support::cpp14::make_unique(_num_ffts); + _fft_kernels.resize(_num_ffts); for(unsigned int i = 0; i < _num_ffts; ++i) { const unsigned int radix_for_stage = decomposed_vector.at(i); diff --git a/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp b/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp index 40ce6b4e0f..03d516f703 100644 --- a/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp +++ b/src/runtime/CL/functions/CLGEMMConvolutionLayer.cpp @@ -372,7 +372,9 @@ Status CLGEMMConvolutionLayer::validate(const ITensorInfo *input, const ITensorI const unsigned int kernel_width = weights->dimension(idx_width); const unsigned int kernel_height = weights->dimension(idx_height); - TensorInfo im2col_reshaped_info, info_gemm, weights_reshaped_info; + TensorInfo im2col_reshaped_info{}; + TensorInfo info_gemm{}; + TensorInfo weights_reshaped_info{}; const ITensorInfo *gemm_input_to_use = input; const ITensorInfo *gemm_output_to_use = output; const ITensorInfo *weights_to_use = weights; diff --git a/src/runtime/CL/functions/CLGaussianPyramid.cpp b/src/runtime/CL/functions/CLGaussianPyramid.cpp index fd82769004..b671b23c87 100644 --- a/src/runtime/CL/functions/CLGaussianPyramid.cpp +++ b/src/runtime/CL/functions/CLGaussianPyramid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -76,10 +76,10 @@ void CLGaussianPyramidHalf::configure(ICLTensor *input, CLPyramid *pyramid, Bord if(num_levels > 1) { - _horizontal_border_handler = arm_compute::support::cpp14::make_unique(num_levels - 1); - _vertical_border_handler = arm_compute::support::cpp14::make_unique(num_levels - 1); - _horizontal_reduction = arm_compute::support::cpp14::make_unique(num_levels - 1); - _vertical_reduction = arm_compute::support::cpp14::make_unique(num_levels - 1); + _horizontal_border_handler.resize(num_levels - 1); + _vertical_border_handler.resize(num_levels - 1); + _horizontal_reduction.resize(num_levels - 1); + _vertical_reduction.resize(num_levels - 1); // Apply half scale to the X dimension of the tensor shape TensorShape tensor_shape = pyramid->info()->tensor_shape(); @@ -153,8 +153,8 @@ void CLGaussianPyramidOrb::configure(ICLTensor *input, CLPyramid *pyramid, Borde if(num_levels > 1) { - _gauss5x5 = arm_compute::support::cpp14::make_unique(num_levels - 1); - _scale_nearest = arm_compute::support::cpp14::make_unique(num_levels - 1); + _gauss5x5.resize(num_levels - 1); + _scale_nearest.resize(num_levels - 1); PyramidInfo pyramid_info(num_levels - 1, SCALE_PYRAMID_ORB, pyramid->info()->tensor_shape(), Format::U8); diff --git a/src/runtime/CL/functions/CLHOGMultiDetection.cpp b/src/runtime/CL/functions/CLHOGMultiDetection.cpp index 0865f50fd5..f799d61b16 100644 --- a/src/runtime/CL/functions/CLHOGMultiDetection.cpp +++ b/src/runtime/CL/functions/CLHOGMultiDetection.cpp @@ -128,12 +128,11 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h _num_block_norm_kernel = input_block_norm.size(); // Number of CLHOGBlockNormalizationKernel kernels to compute _num_hog_detect_kernel = input_hog_detect.size(); // Number of CLHOGDetector functions to compute - _orient_bin_kernel = arm_compute::support::cpp14::make_unique(_num_orient_bin_kernel); - _block_norm_kernel = arm_compute::support::cpp14::make_unique(_num_block_norm_kernel); - _hog_detect_kernel = arm_compute::support::cpp14::make_unique(_num_hog_detect_kernel); - _non_maxima_kernel = arm_compute::support::cpp14::make_unique(); - _hog_space = arm_compute::support::cpp14::make_unique(_num_orient_bin_kernel); - _hog_norm_space = arm_compute::support::cpp14::make_unique(_num_block_norm_kernel); + _orient_bin_kernel.resize(_num_orient_bin_kernel); + _block_norm_kernel.resize(_num_block_norm_kernel); + _hog_detect_kernel.resize(_num_hog_detect_kernel); + _hog_space.resize(_num_orient_bin_kernel); + _hog_norm_space.resize(_num_block_norm_kernel); // Allocate tensors for magnitude and phase TensorInfo info_mag(shape_img, Format::S16); @@ -172,10 +171,10 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h _hog_space[i].allocator()->init(info_space); // Manage intermediate buffers - _memory_group.manage(_hog_space.get() + i); + _memory_group.manage(&_hog_space[i]); // Initialise orientation binning kernel - _orient_bin_kernel[i].configure(&_mag, &_phase, _hog_space.get() + i, multi_hog->model(idx_multi_hog)->info()); + _orient_bin_kernel[i].configure(&_mag, &_phase, &_hog_space[i], multi_hog->model(idx_multi_hog)->info()); } // Allocate intermediate tensors @@ -193,10 +192,10 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h _hog_norm_space[i].allocator()->init(tensor_info); // Manage intermediate buffers - _memory_group.manage(_hog_norm_space.get() + i); + _memory_group.manage(&_hog_norm_space[i]); // Initialize block normalization kernel - _block_norm_kernel[i].configure(_hog_space.get() + idx_orient_bin, _hog_norm_space.get() + i, multi_hog->model(idx_multi_hog)->info()); + _block_norm_kernel[i].configure(&_hog_space[idx_orient_bin], &_hog_norm_space[i], multi_hog->model(idx_multi_hog)->info()); } // Allocate intermediate tensors @@ -212,13 +211,13 @@ void CLHOGMultiDetection::configure(ICLTensor *input, const ICLMultiHOG *multi_h { const size_t idx_block_norm = input_hog_detect[i]; - _hog_detect_kernel[i].configure(_hog_norm_space.get() + idx_block_norm, multi_hog->cl_model(i), detection_windows, detection_window_strides->at(i), threshold, i); + _hog_detect_kernel[i].configure(&_hog_norm_space[idx_block_norm], multi_hog->cl_model(i), detection_windows, detection_window_strides->at(i), threshold, i); } detection_window_strides->unmap(CLScheduler::get().queue()); // Configure non maxima suppression kernel - _non_maxima_kernel->configure(_detection_windows, min_distance); + _non_maxima_kernel.configure(_detection_windows, min_distance); // Allocate intermediate tensors for(size_t i = 0; i < _num_block_norm_kernel; ++i) @@ -242,13 +241,13 @@ void CLHOGMultiDetection::run() // Run orientation binning kernel for(size_t i = 0; i < _num_orient_bin_kernel; ++i) { - CLScheduler::get().enqueue(*(_orient_bin_kernel.get() + i), false); + CLScheduler::get().enqueue(_orient_bin_kernel[i], false); } // Run block normalization kernel for(size_t i = 0; i < _num_block_norm_kernel; ++i) { - CLScheduler::get().enqueue(*(_block_norm_kernel.get() + i), false); + CLScheduler::get().enqueue(_block_norm_kernel[i], false); } // Run HOG detector kernel @@ -262,7 +261,7 @@ void CLHOGMultiDetection::run() { // Map detection windows array before computing non maxima suppression _detection_windows->map(CLScheduler::get().queue(), true); - Scheduler::get().schedule(_non_maxima_kernel.get(), Window::DimY); + Scheduler::get().schedule(&_non_maxima_kernel, Window::DimY); _detection_windows->unmap(CLScheduler::get().queue()); } } diff --git a/src/runtime/CL/functions/CLHarrisCorners.cpp b/src/runtime/CL/functions/CLHarrisCorners.cpp index 342d1cad49..67f550d318 100644 --- a/src/runtime/CL/functions/CLHarrisCorners.cpp +++ b/src/runtime/CL/functions/CLHarrisCorners.cpp @@ -55,7 +55,7 @@ CLHarrisCorners::CLHarrisCorners(std::shared_ptr memory_manager) _gy(), _score(), _nonmax(), - _corners_list(nullptr), + _corners_list(), _num_corner_candidates(0), _corners(nullptr) { @@ -84,7 +84,7 @@ void CLHarrisCorners::configure(ICLImage *input, float threshold, float min_dist _score.allocator()->init(info_f32); _nonmax.allocator()->init(info_f32); - _corners_list = arm_compute::support::cpp14::make_unique(shape.x() * shape.y()); + _corners_list.resize(shape.x() * shape.y()); // Manage intermediate buffers _memory_group.manage(&_gx); @@ -146,13 +146,13 @@ void CLHarrisCorners::configure(ICLImage *input, float threshold, float min_dist _score.allocator()->allocate(); // Init corner candidates kernel - _candidates.configure(&_nonmax, _corners_list.get(), &_num_corner_candidates); + _candidates.configure(&_nonmax, _corners_list.data(), &_num_corner_candidates); // Allocate intermediate buffers _nonmax.allocator()->allocate(); // Init euclidean distance - _sort_euclidean.configure(_corners_list.get(), _corners, &_num_corner_candidates, min_dist); + _sort_euclidean.configure(_corners_list.data(), _corners, &_num_corner_candidates, min_dist); } void CLHarrisCorners::run() diff --git a/src/runtime/CL/functions/CLLaplacianPyramid.cpp b/src/runtime/CL/functions/CLLaplacianPyramid.cpp index 559b57fd8d..a11851898c 100644 --- a/src/runtime/CL/functions/CLLaplacianPyramid.cpp +++ b/src/runtime/CL/functions/CLLaplacianPyramid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -70,8 +70,8 @@ void CLLaplacianPyramid::configure(ICLTensor *input, CLPyramid *pyramid, ICLTens // Create Gaussian Pyramid function _gaussian_pyr_function.configure(input, &_gauss_pyr, border_mode, constant_border_value); - _convf = arm_compute::support::cpp14::make_unique(_num_levels); - _subf = arm_compute::support::cpp14::make_unique(_num_levels); + _convf.resize(_num_levels); + _subf.resize(_num_levels); for(unsigned int i = 0; i < _num_levels; ++i) { diff --git a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp index 911c9b3b27..13116bf08d 100644 --- a/src/runtime/CL/functions/CLLaplacianReconstruct.cpp +++ b/src/runtime/CL/functions/CLLaplacianReconstruct.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -63,8 +63,8 @@ void CLLaplacianReconstruct::configure(const CLPyramid *pyramid, ICLTensor *inpu _tmp_pyr.init(pyramid_info); // Allocate add and scale functions. Level 0 does not need to be scaled. - _addf = arm_compute::support::cpp14::make_unique(num_levels); - _scalef = arm_compute::support::cpp14::make_unique(num_levels - 1); + _addf.resize(num_levels); + _scalef.resize(num_levels - 1); const size_t last_level = num_levels - 1; @@ -85,7 +85,7 @@ void CLLaplacianReconstruct::configure(const CLPyramid *pyramid, ICLTensor *inpu void CLLaplacianReconstruct::run() { - ARM_COMPUTE_ERROR_ON_MSG(_addf == nullptr, "Unconfigured function"); + ARM_COMPUTE_ERROR_ON_MSG(_addf.empty(), "Unconfigured function"); const size_t last_level = _tmp_pyr.info()->num_levels() - 1; diff --git a/src/runtime/CL/functions/CLOpticalFlow.cpp b/src/runtime/CL/functions/CLOpticalFlow.cpp index 7ef1c83d04..a013a1fe19 100644 --- a/src/runtime/CL/functions/CLOpticalFlow.cpp +++ b/src/runtime/CL/functions/CLOpticalFlow.cpp @@ -84,12 +84,12 @@ void CLOpticalFlow::configure(const CLPyramid *old_pyramid, const CLPyramid *new const int old_values_list_length = list_length * window_dimension * window_dimension; // Create kernels and tensors - _tracker_init_kernel = arm_compute::support::cpp14::make_unique(_num_levels); - _tracker_stage0_kernel = arm_compute::support::cpp14::make_unique(_num_levels); - _tracker_stage1_kernel = arm_compute::support::cpp14::make_unique(_num_levels); - _func_scharr = arm_compute::support::cpp14::make_unique(_num_levels); - _scharr_gx = arm_compute::support::cpp14::make_unique(_num_levels); - _scharr_gy = arm_compute::support::cpp14::make_unique(_num_levels); + _tracker_init_kernel.resize(_num_levels); + _tracker_stage0_kernel.resize(_num_levels); + _tracker_stage1_kernel.resize(_num_levels); + _func_scharr.resize(_num_levels); + _scharr_gx.resize(_num_levels); + _scharr_gy.resize(_num_levels); // Create internal keypoint arrays _old_points_internal = arm_compute::support::cpp14::make_unique(list_length); @@ -118,8 +118,8 @@ void CLOpticalFlow::configure(const CLPyramid *old_pyramid, const CLPyramid *new _scharr_gy[i].allocator()->init(tensor_info); // Manage intermediate buffers - _memory_group.manage(_scharr_gx.get() + i); - _memory_group.manage(_scharr_gy.get() + i); + _memory_group.manage(&_scharr_gx[i]); + _memory_group.manage(&_scharr_gy[i]); // Init Scharr kernel _func_scharr[i].configure(old_ith_input, &_scharr_gx[i], &_scharr_gy[i], border_mode, constant_border_value); diff --git a/src/runtime/CL/functions/CLPadLayer.cpp b/src/runtime/CL/functions/CLPadLayer.cpp index dba7f23f3b..99e312183a 100644 --- a/src/runtime/CL/functions/CLPadLayer.cpp +++ b/src/runtime/CL/functions/CLPadLayer.cpp @@ -31,7 +31,7 @@ namespace arm_compute { CLPadLayer::CLPadLayer() - : _copy_kernel(), _mode(), _padding(), _memset_kernel(), _num_dimensions(0), _slice_functions(nullptr), _concat_functions(nullptr), _slice_results(nullptr), _concat_results(nullptr) + : _copy_kernel(), _mode(), _padding(), _memset_kernel(), _num_dimensions(0), _slice_functions(), _concat_functions(), _slice_results(), _concat_results() { } @@ -67,11 +67,16 @@ void CLPadLayer::configure_reflect_symmetric_mode(ICLTensor *input, ICLTensor *o // Two strided slice functions will be required for each dimension padded as well as a // concatenate function and the tensors to hold the temporary results. - _slice_functions = arm_compute::support::cpp14::make_unique(2 * _num_dimensions); - _slice_results = arm_compute::support::cpp14::make_unique(2 * _num_dimensions); - _concat_functions = arm_compute::support::cpp14::make_unique(_num_dimensions); - _concat_results = arm_compute::support::cpp14::make_unique(_num_dimensions - 1); - Coordinates starts_before, ends_before, starts_after, ends_after, strides; + _slice_functions.resize(2 * _num_dimensions); + _slice_results.resize(2 * _num_dimensions); + _concat_functions.resize(_num_dimensions); + _concat_results.resize(_num_dimensions - 1); + + Coordinates starts_before{}; + Coordinates ends_before{}; + Coordinates starts_after{}; + Coordinates ends_after{}; + Coordinates strides{}; ICLTensor *prev = input; for(uint32_t i = 0; i < _num_dimensions; ++i) { diff --git a/src/runtime/CL/functions/CLReduceMean.cpp b/src/runtime/CL/functions/CLReduceMean.cpp index 702ce34a4d..15091f9066 100644 --- a/src/runtime/CL/functions/CLReduceMean.cpp +++ b/src/runtime/CL/functions/CLReduceMean.cpp @@ -40,10 +40,10 @@ void CLReduceMean::configure(ICLTensor *input, const Coordinates &reduction_axis { ARM_COMPUTE_ERROR_ON_NULLPTR(input); - _reduction_ops = reduction_axis.num_dimensions(); - _reduction_kernels = arm_compute::support::cpp14::make_unique(_reduction_ops); - _reduced_outs = arm_compute::support::cpp14::make_unique(_reduction_ops - (keep_dims ? 1 : 0)); - _keep_dims = keep_dims; + _reduction_ops = reduction_axis.num_dimensions(); + _reduction_kernels.resize(_reduction_ops); + _reduced_outs.resize(_reduction_ops - (keep_dims ? 1 : 0)); + _keep_dims = keep_dims; Coordinates axis_local = reduction_axis; const int input_dims = input->info()->num_dimensions(); @@ -57,9 +57,9 @@ void CLReduceMean::configure(ICLTensor *input, const Coordinates &reduction_axis // Perform reduction for every axis for(unsigned int i = 0; i < _reduction_ops; ++i) { - TensorShape out_shape = i == 0 ? input->info()->tensor_shape() : (_reduced_outs.get() + i - 1)->info()->tensor_shape(); + TensorShape out_shape = i == 0 ? input->info()->tensor_shape() : (&_reduced_outs[i - 1])->info()->tensor_shape(); out_shape.set(axis_local[i], 1); - auto in = (i == 0) ? input : (_reduced_outs.get() + i - 1); + auto in = (i == 0) ? input : (&_reduced_outs[i - 1]); if(i == _reduction_ops - 1 && keep_dims) { @@ -68,8 +68,8 @@ void CLReduceMean::configure(ICLTensor *input, const Coordinates &reduction_axis else { _reduced_outs[i].allocator()->init(TensorInfo(out_shape, input->info()->num_channels(), input->info()->data_type(), input->info()->quantization_info())); - _memory_group.manage(_reduced_outs.get() + i); - _reduction_kernels[i].configure(in, _reduced_outs.get() + i, axis_local[i], ReductionOperation::MEAN_SUM); + _memory_group.manage(&_reduced_outs[i]); + _reduction_kernels[i].configure(in, &_reduced_outs[i], axis_local[i], ReductionOperation::MEAN_SUM); } } @@ -92,7 +92,7 @@ void CLReduceMean::configure(ICLTensor *input, const Coordinates &reduction_axis out_shape.remove_dimension(axis_local[i] - i); } auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(out_shape)); - _reshape.configure(_reduced_outs.get() + _reduction_ops - 1, output); + _reshape.configure(&_reduced_outs[_reduction_ops - 1], output); } } diff --git a/src/runtime/CL/functions/CLReductionOperation.cpp b/src/runtime/CL/functions/CLReductionOperation.cpp index bb285d7cc8..9f99d2db6f 100644 --- a/src/runtime/CL/functions/CLReductionOperation.cpp +++ b/src/runtime/CL/functions/CLReductionOperation.cpp @@ -71,7 +71,7 @@ Status CLReductionOperation::validate(const ITensorInfo *input, const ITensorInf else { // Create temporary tensor infos - auto sums_vector = arm_compute::support::cpp14::make_unique(num_of_stages - 1); + std::vector sums_vector(num_of_stages - 1); // Create intermediate tensor info TensorShape shape{ input->tensor_shape() }; @@ -110,17 +110,17 @@ Status CLReductionOperation::validate(const ITensorInfo *input, const ITensorInf } // Validate ReductionOperation only on first kernel - ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(input, sums_vector.get(), axis, first_kernel_op)); + ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(input, &sums_vector[0], axis, first_kernel_op)); // Validate ReductionOperation on intermediate stages for(unsigned int i = 1; i < num_of_stages - 1; ++i) { - ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(sums_vector.get() + i - 1, sums_vector.get() + i, axis, intermediate_kernel_op)); + ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(&sums_vector[i - 1], &sums_vector[i], axis, intermediate_kernel_op)); } // Validate ReductionOperation on the last stage const unsigned int last_stage = num_of_stages - 1; - ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(sums_vector.get() + last_stage - 1, output, axis, last_kernel_op, input->dimension(0))); + ARM_COMPUTE_RETURN_ON_ERROR(CLReductionOperationKernel::validate(&sums_vector[last_stage - 1], output, axis, last_kernel_op, input->dimension(0))); } return Status{}; @@ -133,7 +133,7 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign _is_serial = is_data_type_quantized(input->info()->data_type()) || axis != 0; // Configure reduction operation kernels - _reduction_kernels_vector = arm_compute::support::cpp14::make_unique(_num_of_stages); + _reduction_kernels_vector.resize(_num_of_stages); // Create temporary tensors if(_is_serial) @@ -142,8 +142,8 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign } else { - _border_handlers_vector = arm_compute::support::cpp14::make_unique(_num_of_stages); - _results_vector = arm_compute::support::cpp14::make_unique(_num_of_stages - 1); + _border_handlers_vector.resize(_num_of_stages); + _results_vector.resize(_num_of_stages - 1); TensorShape shape{ input->info()->tensor_shape() }; for(unsigned int i = 0; i < _num_of_stages - 1; i++) { @@ -152,7 +152,7 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign } // Apply ReductionOperation only on first kernel - _memory_group.manage(_results_vector.get()); + _memory_group.manage(&_results_vector[0]); ReductionOperation first_kernel_op; ReductionOperation intermediate_kernel_op; @@ -183,23 +183,23 @@ void CLReductionOperation::configure(ICLTensor *input, ICLTensor *output, unsign ARM_COMPUTE_ERROR("Not supported"); } - _reduction_kernels_vector[0].configure(input, _results_vector.get(), axis, first_kernel_op); + _reduction_kernels_vector[0].configure(input, &_results_vector[0], axis, first_kernel_op); _border_handlers_vector[0].configure(input, _reduction_kernels_vector[0].border_size(), BorderMode::CONSTANT, pixelValue); // Apply ReductionOperation on intermediate stages for(unsigned int i = 1; i < _num_of_stages - 1; ++i) { - _memory_group.manage(_results_vector.get() + i); - _reduction_kernels_vector[i].configure(_results_vector.get() + i - 1, _results_vector.get() + i, axis, intermediate_kernel_op); - _border_handlers_vector[i].configure(_results_vector.get() + i - 1, _reduction_kernels_vector[i].border_size(), BorderMode::CONSTANT, pixelValue); + _memory_group.manage(&_results_vector[i]); + _reduction_kernels_vector[i].configure(&_results_vector[i - 1], &_results_vector[i], axis, intermediate_kernel_op); + _border_handlers_vector[i].configure(&_results_vector[i - 1], _reduction_kernels_vector[i].border_size(), BorderMode::CONSTANT, pixelValue); _results_vector[i - 1].allocator()->allocate(); } // Apply ReductionOperation on the last stage const unsigned int last_stage = _num_of_stages - 1; const unsigned int input_width = input->info()->dimension(0); - _reduction_kernels_vector[last_stage].configure(_results_vector.get() + last_stage - 1, output, axis, last_kernel_op, input_width); - _border_handlers_vector[last_stage].configure(_results_vector.get() + last_stage - 1, _reduction_kernels_vector[last_stage].border_size(), BorderMode::CONSTANT, pixelValue); + _reduction_kernels_vector[last_stage].configure(&_results_vector[last_stage - 1], output, axis, last_kernel_op, input_width); + _border_handlers_vector[last_stage].configure(&_results_vector[last_stage - 1], _reduction_kernels_vector[last_stage].border_size(), BorderMode::CONSTANT, pixelValue); _results_vector[last_stage - 1].allocator()->allocate(); } } diff --git a/src/runtime/CL/functions/CLSplit.cpp b/src/runtime/CL/functions/CLSplit.cpp index f0843517e7..8d37d538c8 100644 --- a/src/runtime/CL/functions/CLSplit.cpp +++ b/src/runtime/CL/functions/CLSplit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -42,8 +42,8 @@ CLSplit::CLSplit() void CLSplit::configure(const ICLTensor *input, const std::vector &outputs, unsigned int axis) { // Create Slice functions - _num_outputs = outputs.size(); - _slice_functions = arm_compute::support::cpp14::make_unique(_num_outputs); + _num_outputs = outputs.size(); + _slice_functions.resize(_num_outputs); // Get output shape const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_split_shape(input->info(), axis, _num_outputs); diff --git a/src/runtime/CL/functions/CLStackLayer.cpp b/src/runtime/CL/functions/CLStackLayer.cpp index 71327fead4..2700b49272 100644 --- a/src/runtime/CL/functions/CLStackLayer.cpp +++ b/src/runtime/CL/functions/CLStackLayer.cpp @@ -46,8 +46,8 @@ CLStackLayer::CLStackLayer() // NOLINT void CLStackLayer::configure(const std::vector &input, int axis, ICLTensor *output) { - _num_inputs = input.size(); - _stack_kernels = arm_compute::support::cpp14::make_unique(_num_inputs); + _num_inputs = input.size(); + _stack_kernels.resize(_num_inputs); // Wrap around negative values const unsigned int axis_u = wrap_around(axis, static_cast(input[0]->info()->num_dimensions() + 1)); diff --git a/src/runtime/CL/functions/CLUnstack.cpp b/src/runtime/CL/functions/CLUnstack.cpp index 428d09148b..eb1dd8cd44 100644 --- a/src/runtime/CL/functions/CLUnstack.cpp +++ b/src/runtime/CL/functions/CLUnstack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -74,7 +74,7 @@ void CLUnstack::configure(const ICLTensor *input, const std::vector // Wrap around negative values const unsigned int axis_u = wrap_axis(axis, input->info()); _num_slices = std::min(outputs_vector_info.size(), input->info()->dimension(axis_u)); - _strided_slice_vector = arm_compute::support::cpp14::make_unique(_num_slices); + _strided_slice_vector.resize(_num_slices); Coordinates slice_start; int32_t slice_end_mask; diff --git a/src/runtime/CL/functions/CLWidthConcatenateLayer.cpp b/src/runtime/CL/functions/CLWidthConcatenateLayer.cpp index 6e42377a07..a8667c3138 100644 --- a/src/runtime/CL/functions/CLWidthConcatenateLayer.cpp +++ b/src/runtime/CL/functions/CLWidthConcatenateLayer.cpp @@ -109,7 +109,7 @@ void CLWidthConcatenateLayer::configure(std::vector inputs_vector, break; default: // Configure generic case WidthConcatenate kernels - _concat_kernels_vector = arm_compute::support::cpp14::make_unique(_num_inputs); + _concat_kernels_vector.resize(_num_inputs); unsigned int width_offset = 0; for(unsigned int i = 0; i < _num_inputs; ++i) diff --git a/src/runtime/CL/tuners/CLLWSList.cpp b/src/runtime/CL/tuners/CLLWSList.cpp index 97134b1b2c..6eb251420c 100644 --- a/src/runtime/CL/tuners/CLLWSList.cpp +++ b/src/runtime/CL/tuners/CLLWSList.cpp @@ -36,7 +36,7 @@ cl::NDRange CLLWSListExhaustive::operator[](size_t index) { ARM_COMPUTE_ERROR_ON(index >= size()); auto coords = index2coords(search_space_shape, index); - return cl::NDRange(coords[0] + 1, coords[1] + 1, coords[2] + 1); + return cl::NDRange{ coords[0] + 1U, coords[1] + 1U, coords[2] + 1U }; } CLLWSListExhaustive::CLLWSListExhaustive(const cl::NDRange &gws) @@ -49,7 +49,7 @@ cl::NDRange CLLWSListNormal::operator[](size_t index) { ARM_COMPUTE_ERROR_ON(index >= size()); auto coords = index2coords(search_space_shape, index); - return cl::NDRange(_lws_x[coords[0]], _lws_y[coords[1]], _lws_z[coords[2]]); + return cl::NDRange{ _lws_x[coords[0]], _lws_y[coords[1]], _lws_z[coords[2]] }; } CLLWSListNormal::CLLWSListNormal(const cl::NDRange &gws) diff --git a/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp b/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp index 79e619cfd6..9a141cb73a 100644 --- a/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp +++ b/src/runtime/CPP/functions/CPPDetectionOutputLayer.cpp @@ -600,7 +600,7 @@ void CPPDetectionOutputLayer::run() if(_info.keep_top_k() > -1 && num_det > _info.keep_top_k()) { std::vector>> score_index_pairs; - for(auto it : indices) + for(auto const &it : indices) { const int label = it.first; const std::vector &label_indices = it.second; @@ -614,7 +614,7 @@ void CPPDetectionOutputLayer::run() for(auto idx : label_indices) { ARM_COMPUTE_ERROR_ON(idx > static_cast(scores.size())); - score_index_pairs.push_back(std::make_pair(scores[idx], std::make_pair(label, idx))); + score_index_pairs.emplace_back(std::make_pair(scores[idx], std::make_pair(label, idx))); } } diff --git a/src/runtime/CPUUtils.cpp b/src/runtime/CPUUtils.cpp index f3355a740b..f7240db99e 100644 --- a/src/runtime/CPUUtils.cpp +++ b/src/runtime/CPUUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -54,16 +54,16 @@ /* Make sure the bits we care about are defined, just in case asm/hwcap.h is * out of date (or for bare metal mode) */ #ifndef HWCAP_ASIMDHP -#define HWCAP_ASIMDHP (1 << 10) -#endif /* HWCAP_ASIMDHP */ +#define HWCAP_ASIMDHP (1 << 10) // NOLINT +#endif /* HWCAP_ASIMDHP */ #ifndef HWCAP_CPUID -#define HWCAP_CPUID (1 << 11) -#endif /* HWCAP_CPUID */ +#define HWCAP_CPUID (1 << 11) // NOLINT +#endif /* HWCAP_CPUID */ #ifndef HWCAP_ASIMDDP -#define HWCAP_ASIMDDP (1 << 20) -#endif /* HWCAP_ASIMDDP */ +#define HWCAP_ASIMDDP (1 << 20) // NOLINT +#endif /* HWCAP_ASIMDDP */ namespace { @@ -146,12 +146,12 @@ CPUModel midr_to_model(const unsigned int midr) break; } } - else if(implementer == 0x48) // HiSilicon CPUs + else if(implementer == 0x48) { // Only CPUs we have code paths for are detected. All other CPUs can be safely classed as "GENERIC" switch(cpunum) { - case 0xd40: // A76 (Kirin 980) + case 0xd40: // A76 model = CPUModel::GENERIC_FP16_DOT; break; default: @@ -220,8 +220,8 @@ void populate_models_cpuinfo(std::vector &cpusv) while(bool(getline(file, line))) { - regmatch_t match[2]; - ret_status = regexec(&proc_regex, line.c_str(), 2, match, 0); + std::array match; + ret_status = regexec(&proc_regex, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string id = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); @@ -244,7 +244,7 @@ void populate_models_cpuinfo(std::vector &cpusv) continue; } - ret_status = regexec(&imp_regex, line.c_str(), 2, match, 0); + ret_status = regexec(&imp_regex, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); @@ -254,7 +254,7 @@ void populate_models_cpuinfo(std::vector &cpusv) continue; } - ret_status = regexec(&var_regex, line.c_str(), 2, match, 0); + ret_status = regexec(&var_regex, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); @@ -264,7 +264,7 @@ void populate_models_cpuinfo(std::vector &cpusv) continue; } - ret_status = regexec(&part_regex, line.c_str(), 2, match, 0); + ret_status = regexec(&part_regex, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); @@ -274,7 +274,7 @@ void populate_models_cpuinfo(std::vector &cpusv) continue; } - ret_status = regexec(&rev_regex, line.c_str(), 2, match, 0); + ret_status = regexec(&rev_regex, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string subexp = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); @@ -302,8 +302,7 @@ void populate_models_cpuinfo(std::vector &cpusv) int get_max_cpus() { - int max_cpus = 1; -#if !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__)) + int max_cpus = 1; std::ifstream CPUspresent; CPUspresent.open("/sys/devices/system/cpu/present", std::ios::in); bool success = false; @@ -341,7 +340,6 @@ int get_max_cpus() { max_cpus = std::thread::hardware_concurrency(); } -#endif /* BARE_METAL */ return max_cpus; } #endif /* !defined(BARE_METAL) && (defined(__arm__) || defined(__aarch64__)) */ @@ -427,8 +425,8 @@ unsigned int get_threads_hint() std::string line; while(bool(getline(cpuinfo, line))) { - regmatch_t match[2]; - ret_status = regexec(&cpu_part_rgx, line.c_str(), 2, match, 0); + std::array match; + ret_status = regexec(&cpu_part_rgx, line.c_str(), 2, match.data(), 0); if(ret_status == 0) { std::string cpu_part = line.substr(match[1].rm_so, (match[1].rm_eo - match[1].rm_so)); diff --git a/src/runtime/Distribution1D.cpp b/src/runtime/Distribution1D.cpp index 3431834c48..9e6fce4e03 100644 --- a/src/runtime/Distribution1D.cpp +++ b/src/runtime/Distribution1D.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -31,12 +31,11 @@ using namespace arm_compute; Distribution1D::Distribution1D(size_t num_bins, int32_t offset, uint32_t range) - : IDistribution1D(num_bins, offset, range), _data(arm_compute::support::cpp14::make_unique(num_bins)) + : IDistribution1D(num_bins, offset, range), _data(num_bins) { } uint32_t *Distribution1D::buffer() const { - ARM_COMPUTE_ERROR_ON(nullptr == _data); - return _data.get(); + return _data.data(); } diff --git a/src/runtime/GLES_COMPUTE/GCMemory.cpp b/src/runtime/GLES_COMPUTE/GCMemory.cpp index fed4a158a3..f1457c4d6e 100644 --- a/src/runtime/GLES_COMPUTE/GCMemory.cpp +++ b/src/runtime/GLES_COMPUTE/GCMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -33,8 +33,8 @@ GCMemory::GCMemory() { } -GCMemory::GCMemory(std::shared_ptr memory) - : _region(nullptr), _region_owned(std::move(memory)) +GCMemory::GCMemory(const std::shared_ptr &memory) + : _region(nullptr), _region_owned(memory) { _region_owned = memory; _region = _region_owned.get(); diff --git a/src/runtime/GLES_COMPUTE/GCScheduler.cpp b/src/runtime/GLES_COMPUTE/GCScheduler.cpp index f7812730fc..6a39e7c360 100644 --- a/src/runtime/GLES_COMPUTE/GCScheduler.cpp +++ b/src/runtime/GLES_COMPUTE/GCScheduler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -97,7 +97,7 @@ void GCScheduler::setup_context() ARM_COMPUTE_ERROR_ON_MSG((strstr(egl_extension_st, "EGL_KHR_surfaceless_context") == nullptr), "Failed to query EGL_KHR_surfaceless_context"); ARM_COMPUTE_UNUSED(egl_extension_st); - const EGLint config_attribs[] = + const std::array config_attribs = { EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, EGL_NONE @@ -105,7 +105,7 @@ void GCScheduler::setup_context() EGLConfig cfg; EGLint count; - res = eglChooseConfig(_display, config_attribs, &cfg, 1, &count); + res = eglChooseConfig(_display, config_attribs.data(), &cfg, 1, &count); ARM_COMPUTE_ERROR_ON_MSG(res == EGL_FALSE, "Failed to choose config: 0x%x.", eglGetError()); ARM_COMPUTE_UNUSED(res); @@ -114,7 +114,7 @@ void GCScheduler::setup_context() ARM_COMPUTE_ERROR_ON_MSG(res == EGL_FALSE, "Failed to bind api: 0x%x.", eglGetError()); - const EGLint attribs[] = + const std::array attribs = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE @@ -122,7 +122,7 @@ void GCScheduler::setup_context() _context = eglCreateContext(_display, cfg, EGL_NO_CONTEXT, - attribs); + attribs.data()); ARM_COMPUTE_ERROR_ON_MSG(_context == EGL_NO_CONTEXT, "Failed to create context: 0x%x.", eglGetError()); ARM_COMPUTE_UNUSED(res); diff --git a/src/runtime/HOG.cpp b/src/runtime/HOG.cpp index 01640bb0ac..e9f38c4d20 100644 --- a/src/runtime/HOG.cpp +++ b/src/runtime/HOG.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -29,20 +29,19 @@ using namespace arm_compute; HOG::HOG() - : IHOG(), _info(), _descriptor(nullptr) + : IHOG(), _info(), _descriptor() { } void HOG::init(const HOGInfo &input) { - ARM_COMPUTE_ERROR_ON(nullptr != _descriptor); - _info = input; - _descriptor = arm_compute::support::cpp14::make_unique(_info.descriptor_size()); + _info = input; + _descriptor.resize(_info.descriptor_size()); } float *HOG::descriptor() const { - return _descriptor.get(); + return _descriptor.data(); } const HOGInfo *HOG::info() const diff --git a/src/runtime/LutAllocator.cpp b/src/runtime/LutAllocator.cpp index eb9051cc0a..0db5217c90 100644 --- a/src/runtime/LutAllocator.cpp +++ b/src/runtime/LutAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -28,23 +28,23 @@ using namespace arm_compute; LutAllocator::LutAllocator() - : _buffer(nullptr) + : _buffer() { } uint8_t *LutAllocator::data() const { - return _buffer.get(); + return _buffer.data(); } void LutAllocator::allocate() { - _buffer = arm_compute::support::cpp14::make_unique(size()); + _buffer.resize(size()); } uint8_t *LutAllocator::lock() { - return _buffer.get(); + return _buffer.data(); } void LutAllocator::unlock() diff --git a/src/runtime/Memory.cpp b/src/runtime/Memory.cpp index d116624679..c6b956d929 100644 --- a/src/runtime/Memory.cpp +++ b/src/runtime/Memory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -32,8 +32,8 @@ Memory::Memory() { } -Memory::Memory(std::shared_ptr memory) - : _region(nullptr), _region_owned(std::move(memory)) +Memory::Memory(const std::shared_ptr &memory) + : _region(nullptr), _region_owned(memory) { _region_owned = memory; _region = _region_owned.get(); diff --git a/src/runtime/MultiHOG.cpp b/src/runtime/MultiHOG.cpp index e0b60b1137..154bbd7acd 100644 --- a/src/runtime/MultiHOG.cpp +++ b/src/runtime/MultiHOG.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -30,8 +30,9 @@ using namespace arm_compute; MultiHOG::MultiHOG(size_t num_models) - : _num_models(num_models), _model(arm_compute::support::cpp14::make_unique(_num_models)) + : _num_models(num_models), _model() { + _model.resize(_num_models); } size_t MultiHOG::num_models() const @@ -42,11 +43,11 @@ size_t MultiHOG::num_models() const IHOG *MultiHOG::model(size_t index) { ARM_COMPUTE_ERROR_ON(index >= _num_models); - return (_model.get() + index); + return (&_model[index]); } const IHOG *MultiHOG::model(size_t index) const { ARM_COMPUTE_ERROR_ON(index >= _num_models); - return (_model.get() + index); + return (&_model[index]); } diff --git a/src/runtime/NEON/functions/NEConcatenateLayer.cpp b/src/runtime/NEON/functions/NEConcatenateLayer.cpp index b8cfa2b8f2..71af560fb0 100644 --- a/src/runtime/NEON/functions/NEConcatenateLayer.cpp +++ b/src/runtime/NEON/functions/NEConcatenateLayer.cpp @@ -51,6 +51,7 @@ void NEConcatenateLayer::configure(const std::vector &inputs_vector, _num_inputs = inputs_vector.size(); std::vector inputs_vector_info; + inputs_vector_info.reserve(_num_inputs); for(unsigned int i = 0; i < _num_inputs; ++i) { ARM_COMPUTE_ERROR_ON_NULLPTR(inputs_vector.at(i)); diff --git a/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp b/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp index fe1f2da457..55e067f52d 100644 --- a/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp +++ b/src/runtime/NEON/functions/NEGEMMAssemblyDispatch.cpp @@ -35,7 +35,7 @@ namespace arm_compute { namespace { -std::unique_ptr create_function_all_types(arm_gemm::KernelDescription gemm_kernel_info, +std::unique_ptr create_function_all_types(const arm_gemm::KernelDescription &gemm_kernel_info, const ITensor *a, const ITensor *b, ITensor *d, float alpha, float beta, bool pretranspose_hint, std::shared_ptr memory_manager) diff --git a/src/runtime/NEON/functions/NEHarrisCorners.cpp b/src/runtime/NEON/functions/NEHarrisCorners.cpp index 15cecc25a0..3eadbee45d 100644 --- a/src/runtime/NEON/functions/NEHarrisCorners.cpp +++ b/src/runtime/NEON/functions/NEHarrisCorners.cpp @@ -90,7 +90,7 @@ void NEHarrisCorners::configure(IImage *input, float threshold, float min_dist, _score.allocator()->init(tensor_info_score); _nonmax.allocator()->init(tensor_info_score); - _corners_list = arm_compute::support::cpp14::make_unique(shape.x() * shape.y()); + _corners_list.resize(shape.x() * shape.y()); // Set/init Sobel kernel accordingly with gradient_size switch(gradient_size) @@ -171,13 +171,13 @@ void NEHarrisCorners::configure(IImage *input, float threshold, float min_dist, _score.allocator()->allocate(); // Init corner candidates kernel - _candidates.configure(&_nonmax, _corners_list.get(), &_num_corner_candidates); + _candidates.configure(&_nonmax, _corners_list.data(), &_num_corner_candidates); // Allocate once all the configure methods have been called _nonmax.allocator()->allocate(); // Init euclidean distance - _sort_euclidean.configure(_corners_list.get(), corners, &_num_corner_candidates, min_dist); + _sort_euclidean.configure(_corners_list.data(), corners, &_num_corner_candidates, min_dist); } void NEHarrisCorners::run() diff --git a/src/runtime/NEON/functions/NEHistogram.cpp b/src/runtime/NEON/functions/NEHistogram.cpp index f333ecb1f8..d56bd7cb16 100644 --- a/src/runtime/NEON/functions/NEHistogram.cpp +++ b/src/runtime/NEON/functions/NEHistogram.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -34,7 +34,7 @@ using namespace arm_compute; NEHistogram::NEHistogram() - : _histogram_kernel(), _local_hist(), _window_lut(arm_compute::support::cpp14::make_unique(window_lut_default_size)), _local_hist_size(0) + : _histogram_kernel(), _local_hist(), _window_lut(window_lut_default_size), _local_hist_size(0) { } @@ -45,10 +45,10 @@ void NEHistogram::configure(const IImage *input, IDistribution1D *output) // Allocate space for threads local histograms _local_hist_size = output->num_bins() * NEScheduler::get().num_threads(); - _local_hist = arm_compute::support::cpp14::make_unique(_local_hist_size); + _local_hist.resize(_local_hist_size); // Configure kernel - _histogram_kernel.configure(input, output, _local_hist.get(), _window_lut.get()); + _histogram_kernel.configure(input, output, _local_hist.data(), _window_lut.data()); } void NEHistogram::run() diff --git a/src/runtime/NEON/functions/NELaplacianPyramid.cpp b/src/runtime/NEON/functions/NELaplacianPyramid.cpp index 0e149d4176..5174a1357e 100644 --- a/src/runtime/NEON/functions/NELaplacianPyramid.cpp +++ b/src/runtime/NEON/functions/NELaplacianPyramid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -92,8 +92,8 @@ void NELaplacianPyramid::configure(const ITensor *input, IPyramid *pyramid, ITen // Create Gaussian Pyramid function _gaussian_pyr_function.configure(input, &_gauss_pyr, border_mode, constant_border_value); - _convf = arm_compute::support::cpp14::make_unique(_num_levels); - _subf = arm_compute::support::cpp14::make_unique(_num_levels); + _convf.resize(_num_levels); + _subf.resize(_num_levels); for(unsigned int i = 0; i < _num_levels; ++i) { diff --git a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp index 9ad9689b13..b2d889b07f 100644 --- a/src/runtime/NEON/functions/NELaplacianReconstruct.cpp +++ b/src/runtime/NEON/functions/NELaplacianReconstruct.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -64,8 +64,8 @@ void NELaplacianReconstruct::configure(const IPyramid *pyramid, ITensor *input, _tmp_pyr.init(pyramid_info); // Allocate add and scale functions. Level 0 does not need to be scaled. - _addf = arm_compute::support::cpp14::make_unique(num_levels); - _scalef = arm_compute::support::cpp14::make_unique(num_levels - 1); + _addf.resize(num_levels); + _scalef.resize(num_levels - 1); const size_t last_level = num_levels - 1; @@ -86,7 +86,7 @@ void NELaplacianReconstruct::configure(const IPyramid *pyramid, ITensor *input, void NELaplacianReconstruct::run() { - ARM_COMPUTE_ERROR_ON_MSG(_addf == nullptr, "Unconfigured function"); + ARM_COMPUTE_ERROR_ON_MSG(_addf.empty(), "Unconfigured function"); const size_t last_level = _tmp_pyr.info()->num_levels() - 1; diff --git a/src/runtime/NEON/functions/NEPadLayer.cpp b/src/runtime/NEON/functions/NEPadLayer.cpp index 6af2ee8868..c608edfdee 100644 --- a/src/runtime/NEON/functions/NEPadLayer.cpp +++ b/src/runtime/NEON/functions/NEPadLayer.cpp @@ -76,8 +76,7 @@ uint32_t last_padding_dimension(const PaddingList &padding) } // namespace NEPadLayer::NEPadLayer() - : _copy_kernel(), _mode(), _padding(), _memset_kernel(), _num_dimensions(0), _slice_functions(nullptr), _concat_functions(nullptr), _slice_results(nullptr), _concat_results(nullptr), - _output_subtensor() + : _copy_kernel(), _mode(), _padding(), _memset_kernel(), _num_dimensions(0), _slice_functions(), _concat_functions(), _slice_results(), _concat_results(), _output_subtensor() { } @@ -108,11 +107,16 @@ void NEPadLayer::configure_reflect_symmetric_mode(ITensor *input, ITensor *outpu // Two strided slice functions will be required for each dimension padded as well as a // concatenate function and the tensors to hold the temporary results. - _slice_functions = arm_compute::support::cpp14::make_unique(2 * _num_dimensions); - _slice_results = arm_compute::support::cpp14::make_unique(2 * _num_dimensions); - _concat_functions = arm_compute::support::cpp14::make_unique(_num_dimensions); - _concat_results = arm_compute::support::cpp14::make_unique(_num_dimensions - 1); - Coordinates starts_before, ends_before, starts_after, ends_after, strides; + _slice_functions.resize(2 * _num_dimensions); + _slice_results.resize(2 * _num_dimensions); + _concat_functions.resize(_num_dimensions); + _concat_results.resize(_num_dimensions - 1); + + Coordinates starts_before{}; + Coordinates ends_before{}; + Coordinates starts_after{}; + Coordinates ends_after{}; + Coordinates strides{}; ITensor *prev = input; for(uint32_t i = 0; i < _num_dimensions; ++i) { @@ -158,7 +162,7 @@ void NEPadLayer::configure_reflect_symmetric_mode(ITensor *input, ITensor *outpu if(i < prev->info()->num_dimensions()) { _slice_functions[2 * i].configure(prev, &_slice_results[2 * i], starts_before, ends_before, strides, begin_mask_before, end_mask_before); - concat_vector.push_back(&_slice_results[2 * i]); + concat_vector.emplace_back(&_slice_results[2 * i]); } else { @@ -172,7 +176,7 @@ void NEPadLayer::configure_reflect_symmetric_mode(ITensor *input, ITensor *outpu if(i < prev->info()->num_dimensions()) { _slice_functions[2 * i + 1].configure(prev, &_slice_results[2 * i + 1], starts_after, ends_after, strides, begin_mask_after, end_mask_after); - concat_vector.push_back(&_slice_results[2 * i + 1]); + concat_vector.emplace_back(&_slice_results[2 * i + 1]); } else { diff --git a/src/runtime/NEON/functions/NEReduceMean.cpp b/src/runtime/NEON/functions/NEReduceMean.cpp index 98d3ab943d..38adaa2a92 100644 --- a/src/runtime/NEON/functions/NEReduceMean.cpp +++ b/src/runtime/NEON/functions/NEReduceMean.cpp @@ -78,10 +78,10 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, { ARM_COMPUTE_ERROR_ON_NULLPTR(input); - _reduction_ops = reduction_axis.num_dimensions(); - _reduction_kernels = arm_compute::support::cpp14::make_unique(_reduction_ops); - _reduced_outs = arm_compute::support::cpp14::make_unique(_reduction_ops - (keep_dims ? 1 : 0)); - _keep_dims = keep_dims; + _reduction_ops = reduction_axis.num_dimensions(); + _reduction_kernels.resize(_reduction_ops); + _reduced_outs.resize(_reduction_ops - (keep_dims ? 1 : 0)); + _keep_dims = keep_dims; Coordinates axis_local = reduction_axis; const int input_dims = input->info()->num_dimensions(); @@ -96,9 +96,9 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, // Perform reduction for every axis for(unsigned int i = 0; i < _reduction_ops; ++i) { - TensorShape out_shape = i == 0 ? input->info()->tensor_shape() : (_reduced_outs.get() + i - 1)->info()->tensor_shape(); + TensorShape out_shape = i == 0 ? input->info()->tensor_shape() : (&_reduced_outs[i - 1])->info()->tensor_shape(); out_shape.set(axis_local[i], 1); - auto in = (i == 0) ? input : (_reduced_outs.get() + i - 1); + auto in = (i == 0) ? input : (&_reduced_outs[i - 1]); if(i == _reduction_ops - 1 && keep_dims) { @@ -107,8 +107,8 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, else { _reduced_outs[i].allocator()->init(TensorInfo(out_shape, input->info()->num_channels(), input->info()->data_type(), input->info()->quantization_info())); - _memory_group.manage(_reduced_outs.get() + i); - _reduction_kernels[i].configure(in, _reduced_outs.get() + i, axis_local[i], ReductionOperation::MEAN_SUM); + _memory_group.manage(&_reduced_outs[i]); + _reduction_kernels[i].configure(in, &_reduced_outs[i], axis_local[i], ReductionOperation::MEAN_SUM); } } @@ -131,7 +131,7 @@ void NEReduceMean::configure(ITensor *input, const Coordinates &reduction_axis, out_shape.remove_dimension(axis_local[i] - i); } auto_init_if_empty(*output->info(), input->info()->clone()->set_tensor_shape(out_shape)); - _reshape.configure(_reduced_outs.get() + _reduction_ops - 1, output); + _reshape.configure(&_reduced_outs[_reduction_ops - 1], output); } } diff --git a/src/runtime/NEON/functions/NESplit.cpp b/src/runtime/NEON/functions/NESplit.cpp index e947657934..0373ab6f88 100644 --- a/src/runtime/NEON/functions/NESplit.cpp +++ b/src/runtime/NEON/functions/NESplit.cpp @@ -42,8 +42,8 @@ NESplit::NESplit() void NESplit::configure(const ITensor *input, const std::vector &outputs, unsigned int axis) { // Create Slice functions - _num_outputs = outputs.size(); - _slice_functions = arm_compute::support::cpp14::make_unique(_num_outputs); + _num_outputs = outputs.size(); + _slice_functions.resize(_num_outputs); // Get output shape const TensorShape output_shape = arm_compute::misc::shape_calculator::compute_split_shape(input->info(), axis, _num_outputs); diff --git a/src/runtime/NEON/functions/NEStackLayer.cpp b/src/runtime/NEON/functions/NEStackLayer.cpp index 2f49c225a4..32350b052c 100644 --- a/src/runtime/NEON/functions/NEStackLayer.cpp +++ b/src/runtime/NEON/functions/NEStackLayer.cpp @@ -43,8 +43,8 @@ NEStackLayer::NEStackLayer() // NOLINT void NEStackLayer::configure(const std::vector &input, int axis, ITensor *output) { - _num_inputs = input.size(); - _stack_kernels = arm_compute::support::cpp14::make_unique(_num_inputs); + _num_inputs = input.size(); + _stack_kernels.resize(_num_inputs); // Wrap around negative values const unsigned int axis_u = wrap_around(axis, static_cast(input[0]->info()->num_dimensions() + 1)); diff --git a/src/runtime/NEON/functions/NEUnstack.cpp b/src/runtime/NEON/functions/NEUnstack.cpp index 7532020973..21f35f8312 100644 --- a/src/runtime/NEON/functions/NEUnstack.cpp +++ b/src/runtime/NEON/functions/NEUnstack.cpp @@ -74,7 +74,7 @@ void NEUnstack::configure(const ITensor *input, const std::vector &ou // Wrap around negative values const unsigned int axis_u = wrap_axis(axis, input->info()); _num_slices = std::min(outputs_vector_info.size(), input->info()->dimension(axis_u)); - _strided_slice_vector = arm_compute::support::cpp14::make_unique(_num_slices); + _strided_slice_vector.resize(_num_slices); Coordinates slice_start; int32_t slice_end_mask; diff --git a/src/runtime/NEON/functions/NEWidthConcatenateLayer.cpp b/src/runtime/NEON/functions/NEWidthConcatenateLayer.cpp index 9fce13cbd7..25b5216305 100644 --- a/src/runtime/NEON/functions/NEWidthConcatenateLayer.cpp +++ b/src/runtime/NEON/functions/NEWidthConcatenateLayer.cpp @@ -79,7 +79,7 @@ inline void NEWidthConcatenateLayer::configure_internal(std::vector(_num_inputs); + _concat_kernels_vector.resize(_num_inputs); for(unsigned int i = 0; i < _num_inputs; ++i) { @@ -112,6 +112,6 @@ void NEWidthConcatenateLayer::run() { for(unsigned i = 0; i < _num_inputs; ++i) { - NEScheduler::get().schedule(_concat_kernels_vector.get() + i, Window::DimY); + NEScheduler::get().schedule(&_concat_kernels_vector[i], Window::DimY); } } diff --git a/src/runtime/Pyramid.cpp b/src/runtime/Pyramid.cpp index ebd65702a6..bc7b5501a0 100644 --- a/src/runtime/Pyramid.cpp +++ b/src/runtime/Pyramid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017 ARM Limited. + * Copyright (c) 2016-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -45,8 +45,8 @@ void Pyramid::init_auto_padding(const PyramidInfo &info) void Pyramid::internal_init(const PyramidInfo &info, bool auto_padding) { - _info = info; - _pyramid = arm_compute::support::cpp14::make_unique(_info.num_levels()); + _info = info; + _pyramid.resize(_info.num_levels()); size_t w = _info.width(); size_t h = _info.height(); @@ -56,11 +56,11 @@ void Pyramid::internal_init(const PyramidInfo &info, bool auto_padding) TensorShape tensor_shape = _info.tensor_shape(); // Note: Look-up table used by the OpenVX sample implementation - const float c_orbscale[4] = { 0.5f, - SCALE_PYRAMID_ORB, - SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB, - SCALE_PYRAMID_ORB *SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB - }; + const std::array c_orbscale = { 0.5f, + SCALE_PYRAMID_ORB, + SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB, + SCALE_PYRAMID_ORB *SCALE_PYRAMID_ORB * SCALE_PYRAMID_ORB + }; for(size_t i = 0; i < _info.num_levels(); ++i) { @@ -71,7 +71,7 @@ void Pyramid::internal_init(const PyramidInfo &info, bool auto_padding) tensor_info.auto_padding(); } - (_pyramid.get() + i)->allocator()->init(tensor_info); + _pyramid[i].allocator()->init(tensor_info); if(is_orb_scale) { @@ -99,11 +99,9 @@ void Pyramid::internal_init(const PyramidInfo &info, bool auto_padding) void Pyramid::allocate() { - ARM_COMPUTE_ERROR_ON(_pyramid == nullptr); - for(size_t i = 0; i < _info.num_levels(); ++i) { - (_pyramid.get() + i)->allocator()->allocate(); + _pyramid[i].allocator()->allocate(); } } @@ -116,5 +114,5 @@ Tensor *Pyramid::get_pyramid_level(size_t index) const { ARM_COMPUTE_ERROR_ON(index >= _info.num_levels()); - return (_pyramid.get() + index); -} + return &_pyramid[index]; +} \ No newline at end of file diff --git a/tests/framework/instruments/OpenCLMemoryUsage.cpp b/tests/framework/instruments/OpenCLMemoryUsage.cpp index 119ad4cad2..7b08e2d85b 100644 --- a/tests/framework/instruments/OpenCLMemoryUsage.cpp +++ b/tests/framework/instruments/OpenCLMemoryUsage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -192,7 +192,7 @@ Instrument::MeasurementsMap OpenCLMemoryUsage::test_measurements() const size_t num_programs = CLKernelLibrary::get().get_built_programs().size(); size_t total_size = 0; - for(auto it : CLKernelLibrary::get().get_built_programs()) + for(auto const &it : CLKernelLibrary::get().get_built_programs()) { std::vector binary_sizes = it.second.getInfo(); total_size = std::accumulate(binary_sizes.begin(), binary_sizes.end(), total_size); diff --git a/tests/framework/instruments/OpenCLTimer.cpp b/tests/framework/instruments/OpenCLTimer.cpp index ca859b6fd9..ca4c13ce61 100644 --- a/tests/framework/instruments/OpenCLTimer.cpp +++ b/tests/framework/instruments/OpenCLTimer.cpp @@ -185,9 +185,12 @@ Instrument::MeasurementsMap OpenCLClock::measurements() const { MeasurementsMap measurements; unsigned int kernel_number = 0; - for(auto kernel : _kernels) + for(auto const &kernel : _kernels) { - cl_ulong queued, flushed, start, end; + cl_ulong queued; + cl_ulong flushed; + cl_ulong start; + cl_ulong end; kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_QUEUED, &queued); kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_SUBMIT, &flushed); kernel.event.getProfilingInfo(CL_PROFILING_COMMAND_START, &start); diff --git a/tests/framework/instruments/SchedulerTimer.cpp b/tests/framework/instruments/SchedulerTimer.cpp index f9d4dd5fce..c114dfbd9d 100644 --- a/tests/framework/instruments/SchedulerTimer.cpp +++ b/tests/framework/instruments/SchedulerTimer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -67,9 +67,9 @@ public: return _real_scheduler.num_threads(); } - void set_prefix(std::string prefix) + void set_prefix(const std::string &prefix) { - _prefix = std::move(prefix); + _prefix = prefix; } void schedule(ICPPKernel *kernel, const Hints &hints) override @@ -188,7 +188,7 @@ Instrument::MeasurementsMap SchedulerClock::measurements() co if(output_timestamps) { ARM_COMPUTE_ERROR_ON(kernel.measurements.size() != 2); - for(auto m : kernel.measurements) + for(auto const &m : kernel.measurements) { if(m.first.find("[start]") != std::string::npos) { diff --git a/tests/framework/printers/JSONPrinter.cpp b/tests/framework/printers/JSONPrinter.cpp index 6b982f5bb0..179cdf9601 100644 --- a/tests/framework/printers/JSONPrinter.cpp +++ b/tests/framework/printers/JSONPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -117,7 +117,7 @@ void JSONPrinter::print_list_tests(const std::vector &infos) { *_stream << R"(, "list_tests" : {)"; bool first = true; - for(auto info : infos) + for(auto const &info : infos) { if(!first) { diff --git a/tests/framework/printers/PrettyPrinter.cpp b/tests/framework/printers/PrettyPrinter.cpp index 318195109c..fe0540a624 100644 --- a/tests/framework/printers/PrettyPrinter.cpp +++ b/tests/framework/printers/PrettyPrinter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -111,7 +111,7 @@ void PrettyPrinter::print_error(const std::exception &error, bool expected) void PrettyPrinter::print_list_tests(const std::vector &infos) { - for(auto info : infos) + for(auto const &info : infos) { *_stream << "[" << info.id << ", " << info.mode << ", " << info.status << "] " << info.name << "\n"; } diff --git a/tests/validation/CL/Convolution.cpp b/tests/validation/CL/Convolution.cpp index 0c00ee301b..9c33d45f97 100644 --- a/tests/validation/CL/Convolution.cpp +++ b/tests/validation/CL/Convolution.cpp @@ -54,14 +54,14 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::NIGHTLY, combine(combine(c CLTensor dst = create_tensor(shape, output_data_type); // Create conv matrix - int16_t conv[9]; + std::array conv = { 0 }; ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function CLConvolution3x3 convolution; - convolution.configure(&src, &dst, conv, 0, border_mode); + convolution.configure(&src, &dst, conv.data(), 0, border_mode); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); @@ -122,14 +122,14 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::NIGHTLY, combine(combine(c CLTensor dst = create_tensor(shape, output_data_type); // Create conv matrix - int16_t conv[25]; + std::array conv = { 0 }; ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function CLConvolution5x5 convolution; - convolution.configure(&src, &dst, conv, 0, border_mode); + convolution.configure(&src, &dst, conv.data(), 0, border_mode); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); @@ -190,14 +190,14 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::NIGHTLY, combine(combine(c CLTensor dst = create_tensor(shape, output_data_type); // Create conv matrix - int16_t conv[49]; + std::array conv = { 0 }; ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function CLConvolution7x7 convolution; - convolution.configure(&src, &dst, conv, 0, border_mode); + convolution.configure(&src, &dst, conv.data(), 0, border_mode); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); @@ -258,14 +258,14 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::NIGHTLY, combine(combine(c CLTensor dst = create_tensor(shape, output_data_type); // Create conv matrix - int16_t conv[81]; + std::array conv = { 0 }; ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function CLConvolution9x9 convolution; - convolution.configure(&src, &dst, conv, 0, border_mode); + convolution.configure(&src, &dst, conv.data(), 0, border_mode); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_size / 2)); @@ -328,14 +328,14 @@ shape, output_data_type, border_mode, filter_width, filter_height) CLTensor dst = create_tensor(shape, output_data_type); // Create conv matrix - int16_t conv[filter_width * filter_height]; + std::vector conv(filter_width * filter_height); ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS); ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS); // Create and configure function CLConvolutionRectangle convolution; - convolution.configure(&src, &dst, conv, filter_width, filter_height, 1, border_mode); + convolution.configure(&src, &dst, conv.data(), filter_width, filter_height, 1, border_mode); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, (border_mode == BorderMode::UNDEFINED), BorderSize(filter_height / 2, filter_width / 2)); diff --git a/tests/validation/CL/DepthConcatenateLayer.cpp b/tests/validation/CL/DepthConcatenateLayer.cpp index beda637ef3..8cbfda382b 100644 --- a/tests/validation/CL/DepthConcatenateLayer.cpp +++ b/tests/validation/CL/DepthConcatenateLayer.cpp @@ -68,6 +68,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( inputs_vector_info.emplace_back(std::move(input_info2)); std::vector inputs_vector_info_raw; + inputs_vector_info_raw.reserve(inputs_vector_info.size()); for(auto &input : inputs_vector_info) { inputs_vector_info_raw.emplace_back(&input); diff --git a/tests/validation/CL/NonLinearFilter.cpp b/tests/validation/CL/NonLinearFilter.cpp index 286cc483b8..536b458975 100644 --- a/tests/validation/CL/NonLinearFilter.cpp +++ b/tests/validation/CL/NonLinearFilter.cpp @@ -52,8 +52,8 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi const uint8_t constant_border_value = distribution_u8(generator); // Create the mask - uint8_t mask[mask_size * mask_size]; - fill_mask_from_pattern(mask, mask_size, mask_size, pattern); + std::vector mask(mask_size * mask_size); + fill_mask_from_pattern(mask.data(), mask_size, mask_size, pattern); const auto half_mask_size = static_cast(mask_size / 2); // Create tensors @@ -65,7 +65,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi // Create and configure function CLNonLinearFilter filter; - filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value); + filter.configure(&src, &dst, function, mask_size, pattern, mask.data(), border_mode, constant_border_value); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size)); diff --git a/tests/validation/CL/Split.cpp b/tests/validation/CL/Split.cpp index 77363189cf..e038b89856 100644 --- a/tests/validation/CL/Split.cpp +++ b/tests/validation/CL/Split.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -57,6 +57,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( { std::vector outputs_info(splits); std::vector outputs_info_ptr; + outputs_info_ptr.reserve(splits); for(auto &output_info : outputs_info) { outputs_info_ptr.emplace_back(&output_info); @@ -76,6 +77,7 @@ DATA_TEST_CASE(Configuration, CLTensor src = create_tensor(shape, data_type); std::vector dsts(splits); std::vector dsts_ptrs; + dsts_ptrs.reserve(splits); for(auto &dst : dsts) { dsts_ptrs.emplace_back(&dst); diff --git a/tests/validation/CL/WidthConcatenateLayer.cpp b/tests/validation/CL/WidthConcatenateLayer.cpp index 2c1eb7fada..52a4e4ccd6 100644 --- a/tests/validation/CL/WidthConcatenateLayer.cpp +++ b/tests/validation/CL/WidthConcatenateLayer.cpp @@ -72,6 +72,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( inputs_vector_info.emplace_back(std::move(input_info2)); std::vector inputs_vector_info_raw; + inputs_vector_info_raw.reserve(inputs_vector_info.size()); for(auto &input : inputs_vector_info) { inputs_vector_info_raw.emplace_back(&input); diff --git a/tests/validation/Helpers.cpp b/tests/validation/Helpers.cpp index 504dbfd3a4..71a674b515 100644 --- a/tests/validation/Helpers.cpp +++ b/tests/validation/Helpers.cpp @@ -269,7 +269,7 @@ std::pair get_quantized_bounds(const QuantizationInfo &quant_info, flo const int min_bound = quant_info.quantize(min, RoundingPolicy::TO_NEAREST_UP); const int max_bound = quant_info.quantize(max, RoundingPolicy::TO_NEAREST_UP); - return std::pair(min_bound, max_bound); + return std::pair { min_bound, max_bound }; } template void get_tile(const SimpleTensor &in, SimpleTensor &roi, const Coordinates &coord); diff --git a/tests/validation/NEON/DepthConcatenateLayer.cpp b/tests/validation/NEON/DepthConcatenateLayer.cpp index 0ddb220d34..844c3987db 100644 --- a/tests/validation/NEON/DepthConcatenateLayer.cpp +++ b/tests/validation/NEON/DepthConcatenateLayer.cpp @@ -68,6 +68,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( inputs_vector_info.emplace_back(std::move(input_info2)); std::vector inputs_vector_info_raw; + inputs_vector_info_raw.reserve(inputs_vector_info.size()); for(auto &input : inputs_vector_info) { inputs_vector_info_raw.emplace_back(&input); diff --git a/tests/validation/NEON/HeightConcatenateLayer.cpp b/tests/validation/NEON/HeightConcatenateLayer.cpp index 9c23fb9bd3..075dfa3b24 100644 --- a/tests/validation/NEON/HeightConcatenateLayer.cpp +++ b/tests/validation/NEON/HeightConcatenateLayer.cpp @@ -72,6 +72,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( inputs_vector_info.emplace_back(std::move(input_info2)); std::vector inputs_vector_info_raw; + inputs_vector_info_raw.reserve(inputs_vector_info.size()); for(auto &input : inputs_vector_info) { inputs_vector_info_raw.emplace_back(&input); diff --git a/tests/validation/NEON/NonLinearFilter.cpp b/tests/validation/NEON/NonLinearFilter.cpp index b3d4c93744..08ad1e2407 100644 --- a/tests/validation/NEON/NonLinearFilter.cpp +++ b/tests/validation/NEON/NonLinearFilter.cpp @@ -52,8 +52,8 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi const uint8_t constant_border_value = distribution_u8(generator); // Create the mask - uint8_t mask[mask_size * mask_size]; - fill_mask_from_pattern(mask, mask_size, mask_size, pattern); + std::vector mask(mask_size * mask_size); + fill_mask_from_pattern(mask.data(), mask_size, mask_size, pattern); const auto half_mask_size = static_cast(mask_size / 2); // Create tensors @@ -65,7 +65,7 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(combi // Create and configure function NENonLinearFilter filter; - filter.configure(&src, &dst, function, mask_size, pattern, mask, border_mode, constant_border_value); + filter.configure(&src, &dst, function, mask_size, pattern, mask.data(), border_mode, constant_border_value); // Validate valid region const ValidRegion dst_valid_region = shape_to_valid_region(shape, border_mode == BorderMode::UNDEFINED, BorderSize(half_mask_size)); diff --git a/tests/validation/NEON/Split.cpp b/tests/validation/NEON/Split.cpp index 17360960e0..91b3b9a047 100644 --- a/tests/validation/NEON/Split.cpp +++ b/tests/validation/NEON/Split.cpp @@ -57,6 +57,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( { std::vector outputs_info(splits); std::vector outputs_info_ptr; + outputs_info_ptr.reserve(splits); for(auto &output_info : outputs_info) { outputs_info_ptr.emplace_back(&output_info); @@ -76,6 +77,7 @@ DATA_TEST_CASE(Configuration, Tensor src = create_tensor(shape, data_type); std::vector dsts(splits); std::vector dsts_ptrs; + dsts_ptrs.reserve(splits); for(auto &dst : dsts) { dsts_ptrs.emplace_back(&dst); diff --git a/tests/validation/NEON/WidthConcatenateLayer.cpp b/tests/validation/NEON/WidthConcatenateLayer.cpp index ed840ef325..ba0ff1bd81 100644 --- a/tests/validation/NEON/WidthConcatenateLayer.cpp +++ b/tests/validation/NEON/WidthConcatenateLayer.cpp @@ -70,6 +70,7 @@ DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip( inputs_vector_info.emplace_back(std::move(input_info2)); std::vector inputs_vector_info_raw; + inputs_vector_info_raw.reserve(inputs_vector_info.size()); for(auto &input : inputs_vector_info) { inputs_vector_info_raw.emplace_back(&input); diff --git a/tests/validation/reference/ArithmeticDivision.cpp b/tests/validation/reference/ArithmeticDivision.cpp index 0102231993..0ced439404 100644 --- a/tests/validation/reference/ArithmeticDivision.cpp +++ b/tests/validation/reference/ArithmeticDivision.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -77,7 +77,9 @@ SimpleTensor arithmetic_division(const SimpleTensor &src1, const SimpleTen { SimpleTensor dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), data_type); - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(src1, src2, dst, id_src1, id_src2, id_dst); diff --git a/tests/validation/reference/ArithmeticOperations.cpp b/tests/validation/reference/ArithmeticOperations.cpp index 062be93b95..a6205af2c6 100644 --- a/tests/validation/reference/ArithmeticOperations.cpp +++ b/tests/validation/reference/ArithmeticOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -88,7 +88,9 @@ struct BroadcastUnroll<0> template SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleTensor &src1, const SimpleTensor &src2, SimpleTensor &dst, ConvertPolicy convert_policy) { - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(op, src1, src2, dst, convert_policy, id_src1, id_src2, id_dst); @@ -98,14 +100,16 @@ SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleTensor< template <> SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleTensor &src1, const SimpleTensor &src2, SimpleTensor &dst, ConvertPolicy convert_policy) { + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; + if(dst.data_type() == DataType::QASYMM8) { SimpleTensor src1_tmp = convert_from_asymmetric(src1); SimpleTensor src2_tmp = convert_from_asymmetric(src2); SimpleTensor dst_tmp(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst.data_type()); - Coordinates id_src1, id_src2, id_dst; - BroadcastUnroll::unroll(op, src1_tmp, src2_tmp, dst_tmp, convert_policy, id_src1, id_src2, id_dst); dst = convert_to_asymmetric(dst_tmp, dst.quantization_info()); @@ -114,8 +118,6 @@ SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleT else { // DataType::U8 - Coordinates id_src1, id_src2, id_dst; - BroadcastUnroll::unroll(op, src1, src2, dst, convert_policy, id_src1, id_src2, id_dst); return dst; diff --git a/tests/validation/reference/CannyEdgeDetector.cpp b/tests/validation/reference/CannyEdgeDetector.cpp index 92a11db0bd..a952ddedb0 100644 --- a/tests/validation/reference/CannyEdgeDetector.cpp +++ b/tests/validation/reference/CannyEdgeDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -117,7 +117,8 @@ SimpleTensor canny_edge_detector_impl(const SimpleTensor &src, int32_t upp ValidRegion valid_region = shape_to_valid_region(src.shape(), border_mode == BorderMode::UNDEFINED, BorderSize(gradient_size / 2 + 1)); // Sobel computation: U == int16_t or int32_t - SimpleTensor gx, gy; + SimpleTensor gx{}; + SimpleTensor gy{}; std::tie(gx, gy) = sobel(src, gradient_size, border_mode, constant_border_value, GradientDimension::GRAD_XY); using unsigned_U = typename traits::make_unsigned_conditional_t::type; @@ -178,7 +179,8 @@ SimpleTensor canny_edge_detector_impl(const SimpleTensor &src, int32_t upp continue; } - unsigned_U mag_90, mag90; + unsigned_U mag_90; + unsigned_U mag90; switch(grad_dir[i]) { case 0: // North/South edge direction, compare against East/West pixels (left & right) diff --git a/tests/validation/reference/Comparisons.cpp b/tests/validation/reference/Comparisons.cpp index a83c365a22..6d08daf89d 100644 --- a/tests/validation/reference/Comparisons.cpp +++ b/tests/validation/reference/Comparisons.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -109,7 +109,9 @@ SimpleTensor compare(ComparisonOperation op, const SimpleTensor &src { SimpleTensor dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), DataType::U8); - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(op, src1, src2, dst, id_src1, id_src2, id_dst); return dst; } @@ -119,18 +121,19 @@ SimpleTensor compare(ComparisonOperation op, const SimpleTensor dst(TensorShape::broadcast_shape(src1.shape(), src2.shape()), DataType::U8); + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; + if(src1.data_type() == DataType::QASYMM8) { SimpleTensor src1_tmp = convert_from_asymmetric(src1); SimpleTensor src2_tmp = convert_from_asymmetric(src2); - - Coordinates id_src1, id_src2, id_dst; BroadcastUnroll::unroll(op, src1_tmp, src2_tmp, dst, id_src1, id_src2, id_dst); } else { // DataType::U8 - Coordinates id_src1, id_src2, id_dst; BroadcastUnroll::unroll(op, src1, src2, dst, id_src1, id_src2, id_dst); } return dst; diff --git a/tests/validation/reference/ConcatenateLayer.cpp b/tests/validation/reference/ConcatenateLayer.cpp index 93b1768ebd..af818a576c 100644 --- a/tests/validation/reference/ConcatenateLayer.cpp +++ b/tests/validation/reference/ConcatenateLayer.cpp @@ -41,6 +41,7 @@ SimpleTensor widthconcatenate_layer(const std::vector> &srcs, { // Create reference std::vector shapes; + shapes.reserve(srcs.size()); for(const auto &src : srcs) { shapes.emplace_back(src.shape()); diff --git a/tests/validation/reference/DepthConcatenateLayer.cpp b/tests/validation/reference/DepthConcatenateLayer.cpp index 139675d108..22271a0d10 100644 --- a/tests/validation/reference/DepthConcatenateLayer.cpp +++ b/tests/validation/reference/DepthConcatenateLayer.cpp @@ -38,7 +38,7 @@ SimpleTensor depthconcatenate_layer(const std::vector> &srcs, { // Create reference std::vector shapes; - + shapes.reserve(srcs.size()); for(const auto &src : srcs) { shapes.emplace_back(src.shape()); @@ -66,7 +66,7 @@ SimpleTensor depthconcatenate_layer(const std::vector> &srcs, { auto ptr_slice = static_cast(dst(Coordinates(0, 0, slice, b))); const auto num_elems_in_slice((dst.num_elements() / depth_out) * src.shape().z()); - std::transform(ptr_slice, ptr_slice + num_elems_in_slice, ptr_slice, [src, dst](T t) + std::transform(ptr_slice, ptr_slice + num_elems_in_slice, ptr_slice, [src, dst](T) { return dst.quantization_info().quantize(src.quantization_info().dequantize(0), RoundingPolicy::TO_NEAREST_UP); }); diff --git a/tests/validation/reference/ElementwiseOperations.cpp b/tests/validation/reference/ElementwiseOperations.cpp index 6d533edea5..2ffb0faa75 100644 --- a/tests/validation/reference/ElementwiseOperations.cpp +++ b/tests/validation/reference/ElementwiseOperations.cpp @@ -124,7 +124,9 @@ struct BroadcastUnroll<0> template SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleTensor &src1, const SimpleTensor &src2, SimpleTensor &dst, ConvertPolicy convert_policy) { - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(op, src1, src2, dst, convert_policy, id_src1, id_src2, id_dst); @@ -140,7 +142,9 @@ SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleT SimpleTensor src2_tmp = convert_from_asymmetric(src2); SimpleTensor dst_tmp(TensorShape::broadcast_shape(src1.shape(), src2.shape()), dst.data_type()); - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(op, src1_tmp, src2_tmp, dst_tmp, convert_policy, id_src1, id_src2, id_dst); @@ -150,7 +154,9 @@ SimpleTensor arithmetic_operation(ArithmeticOperation op, const SimpleT else { // DataType::U8 - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(op, src1, src2, dst, convert_policy, id_src1, id_src2, id_dst); diff --git a/tests/validation/reference/HOGDetector.cpp b/tests/validation/reference/HOGDetector.cpp index 5a5ae3700d..8ca1b0c204 100644 --- a/tests/validation/reference/HOGDetector.cpp +++ b/tests/validation/reference/HOGDetector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -39,8 +39,8 @@ Size2D num_detection_windows(const TensorShape &shape, const Size2D &window_step const size_t num_block_strides_width = hog_info.detection_window_size().width / hog_info.block_stride().width; const size_t num_block_strides_height = hog_info.detection_window_size().height / hog_info.block_stride().height; - return Size2D(floor_to_multiple(shape.x() - num_block_strides_width, window_step.width) + window_step.width, - floor_to_multiple(shape.y() - num_block_strides_height, window_step.height) + window_step.height); + return Size2D{ floor_to_multiple(shape.x() - num_block_strides_width, window_step.width) + window_step.width, + floor_to_multiple(shape.y() - num_block_strides_height, window_step.height) + window_step.height }; } } // namespace diff --git a/tests/validation/reference/PixelWiseMultiplication.cpp b/tests/validation/reference/PixelWiseMultiplication.cpp index 3470de241a..ea058ecdba 100644 --- a/tests/validation/reference/PixelWiseMultiplication.cpp +++ b/tests/validation/reference/PixelWiseMultiplication.cpp @@ -139,7 +139,9 @@ SimpleTensor pixel_wise_multiplication(const SimpleTensor &src1, const S ARM_COMPUTE_ERROR("Scale of pixel-wise multiplication must be non-negative"); } - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(src1, src2, dst, scale, convert_policy, rounding_policy, id_src1, id_src2, id_dst); @@ -166,7 +168,9 @@ SimpleTensor pixel_wise_multiplication(const SimpleTensor &src ARM_COMPUTE_ERROR("Scale of pixel-wise multiplication must be non-negative"); } - Coordinates id_src1, id_src2, id_dst; + Coordinates id_src1{}; + Coordinates id_src2{}; + Coordinates id_dst{}; BroadcastUnroll::unroll(src1, src2, dst, scale, convert_policy, rounding_policy, id_src1, id_src2, id_dst); } return dst; diff --git a/tests/validation/reference/SliceOperations.cpp b/tests/validation/reference/SliceOperations.cpp index 40ca9de927..b34afdc92e 100644 --- a/tests/validation/reference/SliceOperations.cpp +++ b/tests/validation/reference/SliceOperations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -103,7 +103,9 @@ SimpleTensor strided_slice(const SimpleTensor &src, SimpleTensor dst{ dst_shape, src.data_type(), 1 }; // Get coordinates - Coordinates starts_abs, ends_abs, final_strides; + Coordinates starts_abs{}; + Coordinates ends_abs{}; + Coordinates final_strides{}; std::tie(starts_abs, ends_abs, final_strides) = calculate_strided_slice_coords(src_shape, starts, ends, strides, begin_mask, end_mask, shrink_axis_mask); diff --git a/tests/validation/reference/Sobel.cpp b/tests/validation/reference/Sobel.cpp index ff0e11d3a8..233f1ad4fc 100644 --- a/tests/validation/reference/Sobel.cpp +++ b/tests/validation/reference/Sobel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2019 ARM Limited. * * SPDX-License-Identifier: MIT * diff --git a/tests/validation/reference/StackLayer.cpp b/tests/validation/reference/StackLayer.cpp index 50e440c914..9e9e434230 100644 --- a/tests/validation/reference/StackLayer.cpp +++ b/tests/validation/reference/StackLayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited. + * Copyright (c) 2018-2019 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -56,11 +56,11 @@ SimpleTensor stack_layer(const std::vector> &in, const Tensor // i_coordinates[0] = xi, i_coordinates[1] = yi, i_coordinates[2] = zi // i_coordinates[3] = bi, i_coordinates[4] = i, i_coordinates[5] = 0 // i_coordinates[5] will be always zero and used for not incrementing the output when the input has less than 4 dimensions - int i_coordinates[6] = { 0 }; + std::array i_coordinates{ 0 }; // Array of pointers used to map the output coordinates to the input ones accordingly with the axis // This array is initialized with &i_coordinates[5] since this will be always zero - int *o_coordinates[5] = { &i_coordinates[5], &i_coordinates[5], &i_coordinates[5], &i_coordinates[5], &i_coordinates[5] }; + std::array o_coordinates = { &i_coordinates[5], &i_coordinates[5], &i_coordinates[5], &i_coordinates[5], &i_coordinates[5] }; // Set the axis coordinate o_coordinates[axis] = &i_coordinates[4]; diff --git a/tests/validation/reference/Winograd.cpp b/tests/validation/reference/Winograd.cpp index 06463d577f..47f5ac7a7d 100644 --- a/tests/validation/reference/Winograd.cpp +++ b/tests/validation/reference/Winograd.cpp @@ -45,7 +45,7 @@ template void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile_size, const Size2D &kernel_size, WinogradTransformType winograd_transform_type) { // Winograd input transform matrices - static const float imatrix2x2_3x3[] = + static const std::array imatrix2x2_3x3 = { 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, @@ -53,7 +53,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 1.0f, 0.0f, -1.0f }; - static const float imatrix4x4_3x3[] = + static const std::array imatrix4x4_3x3 = { 4.0f, 0.0f, -5.0f, 0.0f, 1.0f, 0.0f, 0.0f, -4.0f, -4.0f, 1.0f, 1.0f, 0.0f, @@ -63,7 +63,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 4.0f, 0.0f, -5.0f, 0.0f, 1.0f, }; - static const float imatrix4x4_5x5[] = + static const std::array imatrix4x4_5x5 = { 1.f, 0.f, -21.f / 4.f, 0.f, 21.f / 4.f, 0.f, -1.f, 0.f, 0.f, 1.f, 1.f, -17.f / 4.f, -17.f / 4.f, 1.f, 1.f, 0.f, @@ -75,7 +75,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.f, -1.f, 0.f, 21.f / 4.f, 0.f, -21.f / 4.f, 0.f, 1.f }; - static const float imatrix2x1_7x7[] = + static const std::array imatrix2x1_7x7 = { -36.0f, 0.0f, 49.0f, 0.0f, -14.0f, 0.0f, 1.0f, 0.0f, 0.0f, -36.0f, 36.0f, 13.0f, -13.0f, -1.0f, 1.0f, 0.0f, @@ -90,7 +90,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile // ------------------------------------------ // Winograd filter transform matrices - static const float fmatrix2x2_3x3[] = + static const std::array fmatrix2x2_3x3 = { 1.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.5f, @@ -98,7 +98,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 0.0f, 1.0f }; - static const float fmatrix4x4_3x3[] = + static const std::array fmatrix4x4_3x3 = { 0.25f, 0.0f, 0.0f, -1.0f / 6.0f, -1.0f / 6.0f, -1.0f / 6.0f, @@ -108,7 +108,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 0.0f, 1.0f }; - static const float fmatrix4x4_5x5[] = + static const std::array fmatrix4x4_5x5 = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, @@ -121,7 +121,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile }; - static const float fmatrix2x1_7x7[] = + static const std::array fmatrix2x1_7x7 = { -1.0f / 36.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f / 48.0f, -1.0f / 48.0f, 1.0f / 48.0f, -1.0f / 48.0f, 1.0f / 48.0f, -1.0f / 48.0f, 1.0f / 48.0f, @@ -136,13 +136,13 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile // ------------------------------------------ // Winograd output transform matrices - static const float omatrix2x2_3x3[] = + static const std::array omatrix2x2_3x3 = { 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, -1.0f }; - static const float omatrix4x4_3x3[] = + static const std::array omatrix4x4_3x3 = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 2.0f, -2.0f, 0.0f, @@ -150,7 +150,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 1.0f, -1.0f, 8.0f, -8.0f, 1.0f }; - static const float omatrix4x4_5x5[] = + static const std::array omatrix4x4_5x5 = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 8.0f, 8.0f, 0.0f, 0.0f, 1.0f, -1.0f, 2.0f, -2.0f, 4.0f, -4.0f, 0.0f, @@ -158,7 +158,7 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile 0.0f, 1.0f, -1.0f, 8.0f, -8.0f, 1.0f, -1.0f, 1.0f }; - static const float omatrix2x1_7x7[] = + static const std::array omatrix2x1_7x7 = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, -1.0f, 1.0f, -2.0f, 2.0f, -3.0f, 3.0f, 1.0f @@ -171,42 +171,42 @@ void initialize_matrix_transform(SimpleTensor &src, const Size2D &output_tile // Key = (Output tile size, Kernel size, Winograd transform type) static std::map matrix_map = { - { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::INPUT), imatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::INPUT), imatrix4x4_3x3 }, - { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::INPUT), imatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::INPUT), imatrix4x4_3x3 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::INPUT), imatrix2x2_3x3 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::INPUT), imatrix4x4_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::INPUT), imatrix4x4_5x5 }, - { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::INPUT), imatrix4x4_5x5 }, - { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::INPUT), imatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::INPUT), imatrix2x1_7x7 }, - { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::INPUT), imatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::INPUT), imatrix4x4_5x5 }, - { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3 }, - { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::FILTER), fmatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::FILTER), fmatrix4x4_3x3 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5 }, - { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::FILTER), fmatrix4x4_5x5 }, - { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::FILTER), fmatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::FILTER), fmatrix2x1_7x7 }, - { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::FILTER), fmatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5 }, - { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3 }, - { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::OUTPUT), omatrix2x2_3x3 }, - { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::OUTPUT), omatrix4x4_3x3 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3 }, - { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5 }, - { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::OUTPUT), omatrix4x4_5x5 }, - { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::OUTPUT), omatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::OUTPUT), omatrix2x1_7x7 }, - { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::OUTPUT), omatrix2x1_7x7 }, - { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5 }, + { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::INPUT), imatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::INPUT), imatrix4x4_3x3.data() }, + { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::INPUT), imatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::INPUT), imatrix4x4_3x3.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::INPUT), imatrix2x2_3x3.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::INPUT), imatrix4x4_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::INPUT), imatrix4x4_5x5.data() }, + { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::INPUT), imatrix4x4_5x5.data() }, + { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::INPUT), imatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::INPUT), imatrix2x1_7x7.data() }, + { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::INPUT), imatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::INPUT), imatrix4x4_5x5.data() }, + { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3.data() }, + { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::FILTER), fmatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::FILTER), fmatrix4x4_3x3.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::FILTER), fmatrix2x2_3x3.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::FILTER), fmatrix4x4_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5.data() }, + { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::FILTER), fmatrix4x4_5x5.data() }, + { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::FILTER), fmatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::FILTER), fmatrix2x1_7x7.data() }, + { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::FILTER), fmatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::FILTER), fmatrix4x4_5x5.data() }, + { WinogradKey(std::pair(2, 2), std::pair(3, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(3, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3.data() }, + { WinogradKey(std::pair(2, 1), std::pair(3, 1), WinogradTransformType::OUTPUT), omatrix2x2_3x3.data() }, + { WinogradKey(std::pair(4, 1), std::pair(3, 1), WinogradTransformType::OUTPUT), omatrix4x4_3x3.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 3), WinogradTransformType::OUTPUT), omatrix2x2_3x3.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 3), WinogradTransformType::OUTPUT), omatrix4x4_3x3.data() }, + { WinogradKey(std::pair(4, 4), std::pair(5, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5.data() }, + { WinogradKey(std::pair(4, 1), std::pair(5, 1), WinogradTransformType::OUTPUT), omatrix4x4_5x5.data() }, + { WinogradKey(std::pair(2, 1), std::pair(7, 1), WinogradTransformType::OUTPUT), omatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 2), std::pair(1, 7), WinogradTransformType::OUTPUT), omatrix2x1_7x7.data() }, + { WinogradKey(std::pair(2, 2), std::pair(7, 7), WinogradTransformType::OUTPUT), omatrix2x1_7x7.data() }, + { WinogradKey(std::pair(1, 4), std::pair(1, 5), WinogradTransformType::OUTPUT), omatrix4x4_5x5.data() }, }; // Find transformation matrix -- cgit v1.2.1