diff options
author | Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-27 17:46:17 +0100 |
---|---|---|
committer | felixjohnny.thomasmathibalan <felixjohnny.thomasmathibalan@arm.com> | 2023-09-28 12:08:05 +0000 |
commit | afd38f0c617d6f89b2b4532c6c44f116617e2b6f (patch) | |
tree | 03bc7d5a762099989b16a656fa8d397b490ed70e /src/graph/backends | |
parent | bdcb4c148ee2fdeaaddf4cf1e57bbb0de02bb894 (diff) | |
download | ComputeLibrary-afd38f0c617d6f89b2b4532c6c44f116617e2b6f.tar.gz |
Apply clang-format on repository
Code is formatted as per a revised clang format configuration
file(not part of this delivery). Version 14.0.6 is used.
Exclusion List:
- files with .cl extension
- files that are not strictly C/C++ (e.g. Android.bp, Sconscript ...)
And the following directories
- compute_kernel_writer/validation/
- tests/
- include/
- src/core/NEON/kernels/convolution/
- src/core/NEON/kernels/arm_gemm/
- src/core/NEON/kernels/arm_conv/
- data/
There will be a follow up for formatting of .cl files and the
files under tests/ and compute_kernel_writer/validation/.
Signed-off-by: Felix Thomasmathibalan <felixjohnny.thomasmathibalan@arm.com>
Change-Id: Ib7eb1fcf4e7537b9feaefcfc15098a804a3fde0a
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/10391
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Diffstat (limited to 'src/graph/backends')
-rw-r--r-- | src/graph/backends/BackendRegistry.cpp | 3 | ||||
-rw-r--r-- | src/graph/backends/CL/CLDeviceBackend.cpp | 37 | ||||
-rw-r--r-- | src/graph/backends/CL/CLFunctionsFactory.cpp | 151 | ||||
-rw-r--r-- | src/graph/backends/CL/CLNodeValidator.cpp | 60 | ||||
-rw-r--r-- | src/graph/backends/CL/CLSubTensorHandle.cpp | 7 | ||||
-rw-r--r-- | src/graph/backends/CL/CLTensorHandle.cpp | 9 | ||||
-rw-r--r-- | src/graph/backends/NEON/NEDeviceBackend.cpp | 29 | ||||
-rw-r--r-- | src/graph/backends/NEON/NEFunctionFactory.cpp | 119 | ||||
-rw-r--r-- | src/graph/backends/NEON/NENodeValidator.cpp | 64 | ||||
-rw-r--r-- | src/graph/backends/NEON/NESubTensorHandle.cpp | 7 | ||||
-rw-r--r-- | src/graph/backends/NEON/NETensorHandle.cpp | 10 |
11 files changed, 296 insertions, 200 deletions
diff --git a/src/graph/backends/BackendRegistry.cpp b/src/graph/backends/BackendRegistry.cpp index 46b4f99e23..bb6af79f8b 100644 --- a/src/graph/backends/BackendRegistry.cpp +++ b/src/graph/backends/BackendRegistry.cpp @@ -31,8 +31,7 @@ namespace graph { namespace backends { -BackendRegistry::BackendRegistry() - : _registered_backends() +BackendRegistry::BackendRegistry() : _registered_backends() { } diff --git a/src/graph/backends/CL/CLDeviceBackend.cpp b/src/graph/backends/CL/CLDeviceBackend.cpp index 01e5ab1730..e27a4109d1 100644 --- a/src/graph/backends/CL/CLDeviceBackend.cpp +++ b/src/graph/backends/CL/CLDeviceBackend.cpp @@ -23,18 +23,17 @@ */ #include "arm_compute/graph/backends/CL/CLDeviceBackend.h" -#include "arm_compute/graph/Graph.h" -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/Logger.h" -#include "arm_compute/graph/Tensor.h" +#include "arm_compute/core/TensorInfo.h" #include "arm_compute/graph/backends/BackendRegistrar.h" #include "arm_compute/graph/backends/CL/CLFunctionFactory.h" #include "arm_compute/graph/backends/CL/CLNodeValidator.h" #include "arm_compute/graph/backends/CL/CLSubTensorHandle.h" #include "arm_compute/graph/backends/CL/CLTensorHandle.h" - -#include "arm_compute/core/TensorInfo.h" +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/GraphContext.h" +#include "arm_compute/graph/INode.h" +#include "arm_compute/graph/Logger.h" +#include "arm_compute/graph/Tensor.h" #include "arm_compute/runtime/BlobLifetimeManager.h" #include "arm_compute/runtime/CL/CLBufferAllocator.h" #include "arm_compute/runtime/CL/CLScheduler.h" @@ -64,7 +63,12 @@ bool file_exists(const std::string &filename) static detail::BackendRegistrar<CLDeviceBackend> CLDeviceBackend_registrar(Target::CL); CLDeviceBackend::CLDeviceBackend() - : _context_count(0), _tuner(), _gemm_heuristics(), _allocator(nullptr), _tuner_file(), _backend_type(CLBackendType::Native) + : _context_count(0), + _tuner(), + _gemm_heuristics(), + _allocator(nullptr), + _tuner_file(), + _backend_type(CLBackendType::Native) { } @@ -95,7 +99,7 @@ void CLDeviceBackend::release_backend_context(GraphContext &ctx) { ARM_COMPUTE_UNUSED(ctx); _context_count--; - if(_context_count == 0) // No more context using the backend: free resources + if (_context_count == 0) // No more context using the backend: free resources { _allocator = nullptr; } @@ -105,7 +109,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) { // Force backend initialization _context_count++; - if(_context_count == 1) + if (_context_count == 1) { _backend_type = ctx.config().backend_type; initialize_backend(); @@ -115,7 +119,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) _tuner_file = ctx.config().tuner_file; // Load tuner data if available - if(file_exists(_tuner_file)) + if (file_exists(_tuner_file)) { _tuner.load_from_file(_tuner_file); } @@ -128,7 +132,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) CLScheduler::get().gemm_heuristics()->reload_from_file(ctx.config().mlgo_file); // Setup a management backend - if(ctx.memory_management_ctx(Target::CL) == nullptr) + if (ctx.memory_management_ctx(Target::CL) == nullptr) { MemoryManagerContext mm_ctx; mm_ctx.target = Target::CL; @@ -141,7 +145,7 @@ void CLDeviceBackend::setup_backend_context(GraphContext &ctx) } // Create function level weights manager - if(ctx.weights_management_ctx(Target::CL) == nullptr) + if (ctx.weights_management_ctx(Target::CL) == nullptr) { WeightsManagerContext wm_ctx; wm_ctx.target = Target::CL; @@ -174,9 +178,10 @@ std::unique_ptr<ITensorHandle> CLDeviceBackend::create_tensor(const Tensor &tens return std::make_unique<CLTensorHandle>(info); } -std::unique_ptr<ITensorHandle> CLDeviceBackend::create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) +std::unique_ptr<ITensorHandle> +CLDeviceBackend::create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) { - if(parent == nullptr) + if (parent == nullptr) { return nullptr; } @@ -203,7 +208,7 @@ arm_compute::Status CLDeviceBackend::validate_node(INode &node) std::shared_ptr<arm_compute::IMemoryManager> CLDeviceBackend::create_memory_manager(MemoryManagerAffinity affinity) { - if(affinity == MemoryManagerAffinity::Offset) + if (affinity == MemoryManagerAffinity::Offset) { ARM_COMPUTE_LOG_GRAPH_WARNING("CL Backend does not support offset affinity memory management!"); return nullptr; diff --git a/src/graph/backends/CL/CLFunctionsFactory.cpp b/src/graph/backends/CL/CLFunctionsFactory.cpp index 882810474e..d4e1aa880f 100644 --- a/src/graph/backends/CL/CLFunctionsFactory.cpp +++ b/src/graph/backends/CL/CLFunctionsFactory.cpp @@ -22,12 +22,12 @@ * SOFTWARE. */ #include "arm_compute/graph/backends/CL/CLFunctionFactory.h" - +#include "arm_compute/graph/backends/FunctionHelpers.h" #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/backends/FunctionHelpers.h" #include "arm_compute/runtime/CL/CLFunctions.h" #include "arm_compute/runtime/CPP/CPPFunctions.h" + #include "src/core/CL/CLKernels.h" #include "support/Cast.h" @@ -89,20 +89,19 @@ class CPPWrapperFunction : public IFunction { public: /* Default constructor */ - CPPWrapperFunction() - : _tensors(), _func(nullptr) + CPPWrapperFunction() : _tensors(), _func(nullptr) { } void run() override { - for(auto &tensor : _tensors) + for (auto &tensor : _tensors) { tensor->map(CLScheduler::get().queue()); } _func->run(); - for(auto &tensor : _tensors) + for (auto &tensor : _tensors) { tensor->unmap(CLScheduler::get().queue()); } @@ -127,7 +126,8 @@ namespace detail { // Specialized functions template <> -std::unique_ptr<IFunction> create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(DetectionOutputLayerNode &node) +std::unique_ptr<IFunction> +create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(DetectionOutputLayerNode &node) { validate_node<CLTargetInfo>(node, 3 /* expected inputs */, 1 /* expected outputs */); @@ -149,16 +149,12 @@ std::unique_ptr<IFunction> create_detection_output_layer<CPPDetectionOutputLayer // Log info ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " - << node.name() - << " Type: " << node.type() - << " Target: " << CLTargetInfo::TargetType - << " Data Type: " << input0->info()->data_type() - << " Input0 shape: " << input0->info()->tensor_shape() - << " Input1 shape: " << input1->info()->tensor_shape() + << node.name() << " Type: " << node.type() << " Target: " << CLTargetInfo::TargetType + << " Data Type: " << input0->info()->data_type() << " Input0 shape: " + << input0->info()->tensor_shape() << " Input1 shape: " << input1->info()->tensor_shape() << " Input2 shape: " << input2->info()->tensor_shape() << " Output shape: " << output->info()->tensor_shape() - << " DetectionOutputLayer info: " << detect_info - << std::endl); + << " DetectionOutputLayer info: " << detect_info << std::endl); auto wrap_function = std::make_unique<CPPWrapperFunction>(); @@ -171,7 +167,8 @@ std::unique_ptr<IFunction> create_detection_output_layer<CPPDetectionOutputLayer return std::move(wrap_function); } template <> -std::unique_ptr<IFunction> create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(DetectionPostProcessLayerNode &node) +std::unique_ptr<IFunction> +create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(DetectionPostProcessLayerNode &node) { validate_node<CLTargetInfo>(node, 3 /* expected inputs */, 4 /* expected outputs */); @@ -199,19 +196,15 @@ std::unique_ptr<IFunction> create_detection_post_process_layer<CPPDetectionPostP // Log info ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " - << node.name() - << " Type: " << node.type() - << " Target: " << CLTargetInfo::TargetType - << " Data Type: " << input0->info()->data_type() - << " Input0 shape: " << input0->info()->tensor_shape() - << " Input1 shape: " << input1->info()->tensor_shape() + << node.name() << " Type: " << node.type() << " Target: " << CLTargetInfo::TargetType + << " Data Type: " << input0->info()->data_type() << " Input0 shape: " + << input0->info()->tensor_shape() << " Input1 shape: " << input1->info()->tensor_shape() << " Input2 shape: " << input2->info()->tensor_shape() << " Output0 shape: " << output0->info()->tensor_shape() << " Output1 shape: " << output1->info()->tensor_shape() << " Output2 shape: " << output2->info()->tensor_shape() << " Output3 shape: " << output3->info()->tensor_shape() - << " DetectionPostProcessLayer info: " << detect_info - << std::endl); + << " DetectionPostProcessLayer info: " << detect_info << std::endl); auto wrap_function = std::make_unique<CPPWrapperFunction>(); @@ -230,92 +223,128 @@ std::unique_ptr<IFunction> create_detection_post_process_layer<CPPDetectionPostP std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext &ctx) { - if(node == nullptr) + if (node == nullptr) { return nullptr; } NodeType type = node->type(); - switch(type) + switch (type) { case NodeType::ActivationLayer: - return detail::create_activation_layer<CLActivationLayer, CLTargetInfo>(*polymorphic_downcast<ActivationLayerNode *>(node)); + return detail::create_activation_layer<CLActivationLayer, CLTargetInfo>( + *polymorphic_downcast<ActivationLayerNode *>(node)); case NodeType::ArgMinMaxLayer: - return detail::create_arg_min_max_layer<CLArgMinMaxLayer, CLTargetInfo>(*polymorphic_downcast<ArgMinMaxLayerNode *>(node)); + return detail::create_arg_min_max_layer<CLArgMinMaxLayer, CLTargetInfo>( + *polymorphic_downcast<ArgMinMaxLayerNode *>(node)); case NodeType::BatchNormalizationLayer: - return detail::create_batch_normalization_layer<CLBatchNormalizationLayer, CLTargetInfo>(*polymorphic_downcast<BatchNormalizationLayerNode *>(node)); + return detail::create_batch_normalization_layer<CLBatchNormalizationLayer, CLTargetInfo>( + *polymorphic_downcast<BatchNormalizationLayerNode *>(node)); case NodeType::BoundingBoxTransformLayer: - return detail::create_bounding_box_transform_layer<CLBoundingBoxTransform, CLTargetInfo>(*polymorphic_downcast<BoundingBoxTransformLayerNode *>(node)); + return detail::create_bounding_box_transform_layer<CLBoundingBoxTransform, CLTargetInfo>( + *polymorphic_downcast<BoundingBoxTransformLayerNode *>(node)); case NodeType::ChannelShuffleLayer: - return detail::create_channel_shuffle_layer<CLChannelShuffleLayer, CLTargetInfo>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node)); + return detail::create_channel_shuffle_layer<CLChannelShuffleLayer, CLTargetInfo>( + *polymorphic_downcast<ChannelShuffleLayerNode *>(node)); case NodeType::ConvolutionLayer: - return detail::create_convolution_layer<CLConvolutionLayerFunctions, CLTargetInfo>(*polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); + return detail::create_convolution_layer<CLConvolutionLayerFunctions, CLTargetInfo>( + *polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); case NodeType::DeconvolutionLayer: - return detail::create_deconvolution_layer<CLDeconvolutionLayer, CLTargetInfo>(*polymorphic_downcast<DeconvolutionLayerNode *>(node), ctx); + return detail::create_deconvolution_layer<CLDeconvolutionLayer, CLTargetInfo>( + *polymorphic_downcast<DeconvolutionLayerNode *>(node), ctx); case NodeType::ConcatenateLayer: - return detail::create_concatenate_layer<CLConcatenateLayer, CLTargetInfo>(*polymorphic_downcast<ConcatenateLayerNode *>(node)); + return detail::create_concatenate_layer<CLConcatenateLayer, CLTargetInfo>( + *polymorphic_downcast<ConcatenateLayerNode *>(node)); case NodeType::DepthToSpaceLayer: - return detail::create_depth_to_space_layer<CLDepthToSpaceLayer, CLTargetInfo>(*polymorphic_downcast<DepthToSpaceLayerNode *>(node)); + return detail::create_depth_to_space_layer<CLDepthToSpaceLayer, CLTargetInfo>( + *polymorphic_downcast<DepthToSpaceLayerNode *>(node)); case NodeType::DepthwiseConvolutionLayer: - return detail::create_depthwise_convolution_layer<CLDepthwiseConvolutionLayer, CLTargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); + return detail::create_depthwise_convolution_layer<CLDepthwiseConvolutionLayer, CLTargetInfo>( + *polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DequantizationLayer: - return detail::create_dequantization_layer<CLDequantizationLayer, CLTargetInfo>(*polymorphic_downcast<DequantizationLayerNode *>(node)); + return detail::create_dequantization_layer<CLDequantizationLayer, CLTargetInfo>( + *polymorphic_downcast<DequantizationLayerNode *>(node)); case NodeType::DetectionOutputLayer: - return detail::create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + return detail::create_detection_output_layer<CPPDetectionOutputLayer, CLTargetInfo>( + *polymorphic_downcast<DetectionOutputLayerNode *>(node)); case NodeType::DetectionPostProcessLayer: - return detail::create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); + return detail::create_detection_post_process_layer<CPPDetectionPostProcessLayer, CLTargetInfo>( + *polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::EltwiseLayer: - return detail::create_eltwise_layer<CLEltwiseFunctions, CLTargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); + return detail::create_eltwise_layer<CLEltwiseFunctions, CLTargetInfo>( + *polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::UnaryEltwiseLayer: - return detail::create_unary_eltwise_layer<CLUnaryEltwiseFunctions, CLTargetInfo>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); + return detail::create_unary_eltwise_layer<CLUnaryEltwiseFunctions, CLTargetInfo>( + *polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); case NodeType::FlattenLayer: - return detail::create_flatten_layer<CLFlattenLayer, CLTargetInfo>(*polymorphic_downcast<FlattenLayerNode *>(node)); + return detail::create_flatten_layer<CLFlattenLayer, CLTargetInfo>( + *polymorphic_downcast<FlattenLayerNode *>(node)); case NodeType::FullyConnectedLayer: - return detail::create_fully_connected_layer<CLFullyConnectedLayer, CLTargetInfo>(*polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); + return detail::create_fully_connected_layer<CLFullyConnectedLayer, CLTargetInfo>( + *polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); case NodeType::FusedConvolutionBatchNormalizationLayer: - return detail::create_fused_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>(*polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node), ctx); + return detail::create_fused_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>( + *polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node), ctx); case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer: - return detail::create_fused_depthwise_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>(*polymorphic_downcast<FusedDepthwiseConvolutionBatchNormalizationNode *>(node), ctx); + return detail::create_fused_depthwise_convolution_batch_normalization_layer<CLFusedLayerTypes, + CLTargetInfo>( + *polymorphic_downcast<FusedDepthwiseConvolutionBatchNormalizationNode *>(node), ctx); case NodeType::GenerateProposalsLayer: - return detail::create_generate_proposals_layer<CLGenerateProposalsLayer, CLTargetInfo>(*polymorphic_downcast<GenerateProposalsLayerNode *>(node), ctx); + return detail::create_generate_proposals_layer<CLGenerateProposalsLayer, CLTargetInfo>( + *polymorphic_downcast<GenerateProposalsLayerNode *>(node), ctx); case NodeType::L2NormalizeLayer: - return detail::create_l2_normalize_layer<CLL2NormalizeLayer, CLTargetInfo>(*polymorphic_downcast<L2NormalizeLayerNode *>(node), ctx); + return detail::create_l2_normalize_layer<CLL2NormalizeLayer, CLTargetInfo>( + *polymorphic_downcast<L2NormalizeLayerNode *>(node), ctx); case NodeType::NormalizationLayer: - return detail::create_normalization_layer<CLNormalizationLayer, CLTargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx); + return detail::create_normalization_layer<CLNormalizationLayer, CLTargetInfo>( + *polymorphic_downcast<NormalizationLayerNode *>(node), ctx); case NodeType::NormalizePlanarYUVLayer: - return detail::create_normalize_planar_yuv_layer<CLNormalizePlanarYUVLayer, CLTargetInfo>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); + return detail::create_normalize_planar_yuv_layer<CLNormalizePlanarYUVLayer, CLTargetInfo>( + *polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); case NodeType::PadLayer: return detail::create_pad_layer<CLPadLayer, CLTargetInfo>(*polymorphic_downcast<PadLayerNode *>(node)); case NodeType::PermuteLayer: - return detail::create_permute_layer<CLPermute, CLTargetInfo>(*polymorphic_downcast<PermuteLayerNode *>(node)); + return detail::create_permute_layer<CLPermute, CLTargetInfo>( + *polymorphic_downcast<PermuteLayerNode *>(node)); case NodeType::PoolingLayer: - return detail::create_pooling_layer<CLPoolingLayer, CLTargetInfo>(*polymorphic_downcast<PoolingLayerNode *>(node)); + return detail::create_pooling_layer<CLPoolingLayer, CLTargetInfo>( + *polymorphic_downcast<PoolingLayerNode *>(node)); case NodeType::PReluLayer: - return detail::create_prelu_layer<CLPReluLayer, CLTargetInfo>(*polymorphic_downcast<PReluLayerNode *>(node)); + return detail::create_prelu_layer<CLPReluLayer, CLTargetInfo>( + *polymorphic_downcast<PReluLayerNode *>(node)); case NodeType::PrintLayer: return detail::create_print_layer<CLTargetInfo>(*polymorphic_downcast<PrintLayerNode *>(node)); case NodeType::PriorBoxLayer: - return detail::create_priorbox_layer<CLPriorBoxLayer, CLTargetInfo>(*polymorphic_downcast<PriorBoxLayerNode *>(node)); + return detail::create_priorbox_layer<CLPriorBoxLayer, CLTargetInfo>( + *polymorphic_downcast<PriorBoxLayerNode *>(node)); case NodeType::QuantizationLayer: - return detail::create_quantization_layer<CLQuantizationLayer, CLTargetInfo>(*polymorphic_downcast<QuantizationLayerNode *>(node)); + return detail::create_quantization_layer<CLQuantizationLayer, CLTargetInfo>( + *polymorphic_downcast<QuantizationLayerNode *>(node)); case NodeType::ReductionOperationLayer: - return detail::create_reduction_operation_layer<CLReductionOperation, CLTargetInfo>(*polymorphic_downcast<ReductionLayerNode *>(node), ctx); + return detail::create_reduction_operation_layer<CLReductionOperation, CLTargetInfo>( + *polymorphic_downcast<ReductionLayerNode *>(node), ctx); case NodeType::ReorgLayer: - return detail::create_reorg_layer<CLReorgLayer, CLTargetInfo>(*polymorphic_downcast<ReorgLayerNode *>(node)); + return detail::create_reorg_layer<CLReorgLayer, CLTargetInfo>( + *polymorphic_downcast<ReorgLayerNode *>(node)); case NodeType::ReshapeLayer: - return detail::create_reshape_layer<CLReshapeLayer, CLTargetInfo>(*polymorphic_downcast<ReshapeLayerNode *>(node)); + return detail::create_reshape_layer<CLReshapeLayer, CLTargetInfo>( + *polymorphic_downcast<ReshapeLayerNode *>(node)); case NodeType::ResizeLayer: return detail::create_resize_layer<CLScale, CLTargetInfo>(*polymorphic_downcast<ResizeLayerNode *>(node)); case NodeType::ROIAlignLayer: - return detail::create_roi_align_layer<CLROIAlignLayer, CLTargetInfo>(*polymorphic_downcast<ROIAlignLayerNode *>(node)); + return detail::create_roi_align_layer<CLROIAlignLayer, CLTargetInfo>( + *polymorphic_downcast<ROIAlignLayerNode *>(node)); case NodeType::SliceLayer: return detail::create_slice_layer<CLSlice, CLTargetInfo>(*polymorphic_downcast<SliceLayerNode *>(node)); case NodeType::SoftmaxLayer: - return detail::create_softmax_layer<CLSoftmaxLayer, CLTargetInfo>(*polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); + return detail::create_softmax_layer<CLSoftmaxLayer, CLTargetInfo>( + *polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); case NodeType::StackLayer: - return detail::create_stack_layer<CLStackLayer, CLTargetInfo>(*polymorphic_downcast<StackLayerNode *>(node)); + return detail::create_stack_layer<CLStackLayer, CLTargetInfo>( + *polymorphic_downcast<StackLayerNode *>(node)); case NodeType::StridedSliceLayer: - return detail::create_strided_slice_layer<CLStridedSlice, CLTargetInfo>(*polymorphic_downcast<StridedSliceLayerNode *>(node)); + return detail::create_strided_slice_layer<CLStridedSlice, CLTargetInfo>( + *polymorphic_downcast<StridedSliceLayerNode *>(node)); default: return nullptr; } diff --git a/src/graph/backends/CL/CLNodeValidator.cpp b/src/graph/backends/CL/CLNodeValidator.cpp index 8fd8c14f63..510eda7935 100644 --- a/src/graph/backends/CL/CLNodeValidator.cpp +++ b/src/graph/backends/CL/CLNodeValidator.cpp @@ -25,7 +25,6 @@ #include "arm_compute/graph/backends/ValidateHelpers.h" #include "arm_compute/graph/nodes/Nodes.h" - #include "arm_compute/runtime/CL/CLFunctions.h" #include "arm_compute/runtime/CPP/CPPFunctions.h" @@ -57,41 +56,51 @@ struct CLUnaryEltwiseLayerFunctions Status CLNodeValidator::validate(INode *node) { - if(node == nullptr) + if (node == nullptr) { return Status{}; } NodeType type = node->type(); - switch(type) + switch (type) { case NodeType::ArgMinMaxLayer: - return detail::validate_arg_min_max_layer<CLArgMinMaxLayer>(*polymorphic_downcast<ArgMinMaxLayerNode *>(node)); + return detail::validate_arg_min_max_layer<CLArgMinMaxLayer>( + *polymorphic_downcast<ArgMinMaxLayerNode *>(node)); case NodeType::BoundingBoxTransformLayer: - return detail::validate_bounding_box_transform_layer<CLBoundingBoxTransform>(*polymorphic_downcast<BoundingBoxTransformLayerNode *>(node)); + return detail::validate_bounding_box_transform_layer<CLBoundingBoxTransform>( + *polymorphic_downcast<BoundingBoxTransformLayerNode *>(node)); case NodeType::ChannelShuffleLayer: - return detail::validate_channel_shuffle_layer<CLChannelShuffleLayer>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node)); + return detail::validate_channel_shuffle_layer<CLChannelShuffleLayer>( + *polymorphic_downcast<ChannelShuffleLayerNode *>(node)); case NodeType::ConvolutionLayer: - return detail::validate_convolution_layer<CLConvolutionLayer, - CLDirectConvolutionLayer, - CLGEMMConvolutionLayer, - CLWinogradConvolutionLayer>(*polymorphic_downcast<ConvolutionLayerNode *>(node)); + return detail::validate_convolution_layer<CLConvolutionLayer, CLDirectConvolutionLayer, + CLGEMMConvolutionLayer, CLWinogradConvolutionLayer>( + *polymorphic_downcast<ConvolutionLayerNode *>(node)); case NodeType::DepthToSpaceLayer: - return detail::validate_depth_to_space_layer<CLDepthToSpaceLayer>(*polymorphic_downcast<DepthToSpaceLayerNode *>(node)); + return detail::validate_depth_to_space_layer<CLDepthToSpaceLayer>( + *polymorphic_downcast<DepthToSpaceLayerNode *>(node)); case NodeType::DepthwiseConvolutionLayer: - return detail::validate_depthwise_convolution_layer<CLDepthwiseConvolutionLayer>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); + return detail::validate_depthwise_convolution_layer<CLDepthwiseConvolutionLayer>( + *polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DequantizationLayer: - return detail::validate_dequantization_layer<CLDequantizationLayer>(*polymorphic_downcast<DequantizationLayerNode *>(node)); + return detail::validate_dequantization_layer<CLDequantizationLayer>( + *polymorphic_downcast<DequantizationLayerNode *>(node)); case NodeType::DetectionOutputLayer: - return detail::validate_detection_output_layer<CPPDetectionOutputLayer>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + return detail::validate_detection_output_layer<CPPDetectionOutputLayer>( + *polymorphic_downcast<DetectionOutputLayerNode *>(node)); case NodeType::DetectionPostProcessLayer: - return detail::validate_detection_post_process_layer<CPPDetectionPostProcessLayer>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); + return detail::validate_detection_post_process_layer<CPPDetectionPostProcessLayer>( + *polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::GenerateProposalsLayer: - return detail::validate_generate_proposals_layer<CLGenerateProposalsLayer>(*polymorphic_downcast<GenerateProposalsLayerNode *>(node)); + return detail::validate_generate_proposals_layer<CLGenerateProposalsLayer>( + *polymorphic_downcast<GenerateProposalsLayerNode *>(node)); case NodeType::L2NormalizeLayer: - return detail::validate_l2_normalize_layer<CLL2NormalizeLayer>(*polymorphic_downcast<L2NormalizeLayerNode *>(node)); + return detail::validate_l2_normalize_layer<CLL2NormalizeLayer>( + *polymorphic_downcast<L2NormalizeLayerNode *>(node)); case NodeType::NormalizePlanarYUVLayer: - return detail::validate_normalize_planar_yuv_layer<CLNormalizePlanarYUVLayer>(*polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); + return detail::validate_normalize_planar_yuv_layer<CLNormalizePlanarYUVLayer>( + *polymorphic_downcast<NormalizePlanarYUVLayerNode *>(node)); case NodeType::PadLayer: return detail::validate_pad_layer<CLPadLayer>(*polymorphic_downcast<PadLayerNode *>(node)); case NodeType::PermuteLayer: @@ -101,9 +110,11 @@ Status CLNodeValidator::validate(INode *node) case NodeType::PriorBoxLayer: return detail::validate_priorbox_layer<CLPriorBoxLayer>(*polymorphic_downcast<PriorBoxLayerNode *>(node)); case NodeType::QuantizationLayer: - return detail::validate_quantization_layer<CLQuantizationLayer>(*polymorphic_downcast<QuantizationLayerNode *>(node)); + return detail::validate_quantization_layer<CLQuantizationLayer>( + *polymorphic_downcast<QuantizationLayerNode *>(node)); case NodeType::ReductionOperationLayer: - return detail::validate_reduction_operation_layer<CLReductionOperation>(*polymorphic_downcast<ReductionLayerNode *>(node)); + return detail::validate_reduction_operation_layer<CLReductionOperation>( + *polymorphic_downcast<ReductionLayerNode *>(node)); case NodeType::ReorgLayer: return detail::validate_reorg_layer<CLReorgLayer>(*polymorphic_downcast<ReorgLayerNode *>(node)); case NodeType::ReshapeLayer: @@ -113,11 +124,14 @@ Status CLNodeValidator::validate(INode *node) case NodeType::SliceLayer: return detail::validate_slice_layer<CLSlice>(*polymorphic_downcast<SliceLayerNode *>(node)); case NodeType::StridedSliceLayer: - return detail::validate_strided_slice_layer<CLStridedSlice>(*polymorphic_downcast<StridedSliceLayerNode *>(node)); + return detail::validate_strided_slice_layer<CLStridedSlice>( + *polymorphic_downcast<StridedSliceLayerNode *>(node)); case NodeType::EltwiseLayer: - return detail::validate_eltwise_Layer<CLEltwiseLayerFunctions>(*polymorphic_downcast<EltwiseLayerNode *>(node)); + return detail::validate_eltwise_Layer<CLEltwiseLayerFunctions>( + *polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::UnaryEltwiseLayer: - return detail::validate_unary_eltwise_layer<CLUnaryEltwiseLayerFunctions>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); + return detail::validate_unary_eltwise_layer<CLUnaryEltwiseLayerFunctions>( + *polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); default: return Status{}; } diff --git a/src/graph/backends/CL/CLSubTensorHandle.cpp b/src/graph/backends/CL/CLSubTensorHandle.cpp index b97d25890a..ccdc877a18 100644 --- a/src/graph/backends/CL/CLSubTensorHandle.cpp +++ b/src/graph/backends/CL/CLSubTensorHandle.cpp @@ -31,7 +31,10 @@ namespace graph { namespace backends { -CLSubTensorHandle::CLSubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent) +CLSubTensorHandle::CLSubTensorHandle(ITensorHandle *parent_handle, + const TensorShape &shape, + const Coordinates &coords, + bool extend_parent) : _sub_tensor(), _parent_handle(nullptr) { ARM_COMPUTE_ERROR_ON(!parent_handle); @@ -98,4 +101,4 @@ Target CLSubTensorHandle::target() const } } // namespace backends } // namespace graph -} // namespace arm_compute
\ No newline at end of file +} // namespace arm_compute diff --git a/src/graph/backends/CL/CLTensorHandle.cpp b/src/graph/backends/CL/CLTensorHandle.cpp index a496c2ce47..1b69f9dede 100644 --- a/src/graph/backends/CL/CLTensorHandle.cpp +++ b/src/graph/backends/CL/CLTensorHandle.cpp @@ -31,8 +31,7 @@ namespace graph { namespace backends { -CLTensorHandle::CLTensorHandle(const ITensorInfo &info) - : _tensor() +CLTensorHandle::CLTensorHandle(const ITensorInfo &info) : _tensor() { _tensor.allocator()->init(info); } @@ -49,7 +48,7 @@ void CLTensorHandle::free() void CLTensorHandle::manage(IMemoryGroup *mg) { - if(mg != nullptr) + if (mg != nullptr) { mg->manage(&_tensor); } @@ -68,7 +67,7 @@ void CLTensorHandle::unmap() void CLTensorHandle::release_if_unused() { // TODO (geopin01): Release tensor only if all sub-tensors are marked as not used - if(!_tensor.is_used()) + if (!_tensor.is_used()) { _tensor.allocator()->free(); } @@ -100,4 +99,4 @@ Target CLTensorHandle::target() const } } // namespace backends } // namespace graph -} // namespace arm_compute
\ No newline at end of file +} // namespace arm_compute diff --git a/src/graph/backends/NEON/NEDeviceBackend.cpp b/src/graph/backends/NEON/NEDeviceBackend.cpp index 18456538da..fc7b309803 100644 --- a/src/graph/backends/NEON/NEDeviceBackend.cpp +++ b/src/graph/backends/NEON/NEDeviceBackend.cpp @@ -23,18 +23,17 @@ */ #include "arm_compute/graph/backends/NEON/NEDeviceBackend.h" -#include "arm_compute/graph/Graph.h" -#include "arm_compute/graph/GraphContext.h" -#include "arm_compute/graph/INode.h" -#include "arm_compute/graph/Logger.h" -#include "arm_compute/graph/Tensor.h" +#include "arm_compute/core/TensorInfo.h" #include "arm_compute/graph/backends/BackendRegistrar.h" #include "arm_compute/graph/backends/NEON/NEFunctionFactory.h" #include "arm_compute/graph/backends/NEON/NENodeValidator.h" #include "arm_compute/graph/backends/NEON/NESubTensorHandle.h" #include "arm_compute/graph/backends/NEON/NETensorHandle.h" - -#include "arm_compute/core/TensorInfo.h" +#include "arm_compute/graph/Graph.h" +#include "arm_compute/graph/GraphContext.h" +#include "arm_compute/graph/INode.h" +#include "arm_compute/graph/Logger.h" +#include "arm_compute/graph/Tensor.h" #include "arm_compute/runtime/Allocator.h" #include "arm_compute/runtime/BlobLifetimeManager.h" #include "arm_compute/runtime/IWeightsManager.h" @@ -53,8 +52,7 @@ namespace backends /** Register CPU backend */ static detail::BackendRegistrar<NEDeviceBackend> NEDeviceBackend_registrar(Target::NEON); -NEDeviceBackend::NEDeviceBackend() - : _allocator() +NEDeviceBackend::NEDeviceBackend() : _allocator() { } @@ -72,13 +70,13 @@ void NEDeviceBackend::release_backend_context(GraphContext &ctx) void NEDeviceBackend::setup_backend_context(GraphContext &ctx) { // Set number of threads - if(ctx.config().num_threads >= 0) + if (ctx.config().num_threads >= 0) { Scheduler::get().set_num_threads(ctx.config().num_threads); } // Create function level memory manager - if(ctx.memory_management_ctx(Target::NEON) == nullptr) + if (ctx.memory_management_ctx(Target::NEON) == nullptr) { MemoryManagerContext mm_ctx; mm_ctx.target = Target::NEON; @@ -91,7 +89,7 @@ void NEDeviceBackend::setup_backend_context(GraphContext &ctx) } // Create function level weights manager - if(ctx.weights_management_ctx(Target::NEON) == nullptr) + if (ctx.weights_management_ctx(Target::NEON) == nullptr) { WeightsManagerContext wm_ctx; wm_ctx.target = Target::NEON; @@ -124,9 +122,10 @@ std::unique_ptr<ITensorHandle> NEDeviceBackend::create_tensor(const Tensor &tens return std::make_unique<NETensorHandle>(info); } -std::unique_ptr<ITensorHandle> NEDeviceBackend::create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) +std::unique_ptr<ITensorHandle> +NEDeviceBackend::create_subtensor(ITensorHandle *parent, TensorShape shape, Coordinates coords, bool extend_parent) { - if(parent == nullptr) + if (parent == nullptr) { return nullptr; } @@ -154,7 +153,7 @@ arm_compute::Status NEDeviceBackend::validate_node(INode &node) std::shared_ptr<arm_compute::IMemoryManager> NEDeviceBackend::create_memory_manager(MemoryManagerAffinity affinity) { std::shared_ptr<ILifetimeManager> lifetime_mgr = nullptr; - if(affinity == MemoryManagerAffinity::Buffer) + if (affinity == MemoryManagerAffinity::Buffer) { lifetime_mgr = std::make_shared<BlobLifetimeManager>(); } diff --git a/src/graph/backends/NEON/NEFunctionFactory.cpp b/src/graph/backends/NEON/NEFunctionFactory.cpp index d7ed5f9ecb..fe15d4cec1 100644 --- a/src/graph/backends/NEON/NEFunctionFactory.cpp +++ b/src/graph/backends/NEON/NEFunctionFactory.cpp @@ -23,13 +23,13 @@ */ #include "arm_compute/graph/backends/NEON/NEFunctionFactory.h" +#include "arm_compute/graph/backends/FunctionHelpers.h" +#include "arm_compute/graph/backends/Utils.h" #include "arm_compute/graph/Graph.h" #include "arm_compute/graph/GraphContext.h" #include "arm_compute/graph/Logger.h" -#include "arm_compute/graph/TypePrinter.h" -#include "arm_compute/graph/backends/FunctionHelpers.h" -#include "arm_compute/graph/backends/Utils.h" #include "arm_compute/graph/nodes/Nodes.h" +#include "arm_compute/graph/TypePrinter.h" #include "arm_compute/runtime/CPP/CPPFunctions.h" #include "arm_compute/runtime/NEON/NEFunctions.h" @@ -88,7 +88,8 @@ struct NEFusedLayerTypes namespace detail { template <> -std::unique_ptr<IFunction> create_normalization_layer<NENormalizationLayer, NETargetInfo>(NormalizationLayerNode &node, GraphContext &ctx) +std::unique_ptr<IFunction> create_normalization_layer<NENormalizationLayer, NETargetInfo>(NormalizationLayerNode &node, + GraphContext &ctx) { validate_node<NETargetInfo>(node, 1 /* expected inputs */, 1 /* expected outputs */); @@ -105,14 +106,10 @@ std::unique_ptr<IFunction> create_normalization_layer<NENormalizationLayer, NETa // Log info ARM_COMPUTE_LOG_GRAPH_INFO("Instantiated " - << node.name() - << " Type: " << node.type() - << " Target: " << NETargetInfo::TargetType - << " Data Type: " << input->info()->data_type() - << " Input shape: " << input->info()->tensor_shape() - << " Output shape: " << output->info()->tensor_shape() - << " Normalization info: " << norm_info.type() - << std::endl); + << node.name() << " Type: " << node.type() << " Target: " << NETargetInfo::TargetType + << " Data Type: " << input->info()->data_type() << " Input shape: " + << input->info()->tensor_shape() << " Output shape: " << output->info()->tensor_shape() + << " Normalization info: " << norm_info.type() << std::endl); return func; } @@ -120,84 +117,116 @@ std::unique_ptr<IFunction> create_normalization_layer<NENormalizationLayer, NETa std::unique_ptr<IFunction> NEFunctionFactory::create(INode *node, GraphContext &ctx) { - if(node == nullptr) + if (node == nullptr) { return nullptr; } NodeType type = node->type(); - switch(type) + switch (type) { case NodeType::ActivationLayer: - return detail::create_activation_layer<NEActivationLayer, NETargetInfo>(*polymorphic_downcast<ActivationLayerNode *>(node)); + return detail::create_activation_layer<NEActivationLayer, NETargetInfo>( + *polymorphic_downcast<ActivationLayerNode *>(node)); case NodeType::ArgMinMaxLayer: - return detail::create_arg_min_max_layer<NEArgMinMaxLayer, NETargetInfo>(*polymorphic_downcast<ArgMinMaxLayerNode *>(node)); + return detail::create_arg_min_max_layer<NEArgMinMaxLayer, NETargetInfo>( + *polymorphic_downcast<ArgMinMaxLayerNode *>(node)); case NodeType::BatchNormalizationLayer: - return detail::create_batch_normalization_layer<NEBatchNormalizationLayer, NETargetInfo>(*polymorphic_downcast<BatchNormalizationLayerNode *>(node)); + return detail::create_batch_normalization_layer<NEBatchNormalizationLayer, NETargetInfo>( + *polymorphic_downcast<BatchNormalizationLayerNode *>(node)); case NodeType::ChannelShuffleLayer: - return detail::create_channel_shuffle_layer<NEChannelShuffleLayer, NETargetInfo>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node)); + return detail::create_channel_shuffle_layer<NEChannelShuffleLayer, NETargetInfo>( + *polymorphic_downcast<ChannelShuffleLayerNode *>(node)); case NodeType::ConvolutionLayer: - return detail::create_convolution_layer<NEConvolutionLayerFunctions, NETargetInfo>(*polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); + return detail::create_convolution_layer<NEConvolutionLayerFunctions, NETargetInfo>( + *polymorphic_downcast<ConvolutionLayerNode *>(node), ctx); case NodeType::DepthToSpaceLayer: - return detail::create_depth_to_space_layer<NEDepthToSpaceLayer, NETargetInfo>(*polymorphic_downcast<DepthToSpaceLayerNode *>(node)); + return detail::create_depth_to_space_layer<NEDepthToSpaceLayer, NETargetInfo>( + *polymorphic_downcast<DepthToSpaceLayerNode *>(node)); case NodeType::DeconvolutionLayer: - return detail::create_deconvolution_layer<NEDeconvolutionLayer, NETargetInfo>(*polymorphic_downcast<DeconvolutionLayerNode *>(node), ctx); + return detail::create_deconvolution_layer<NEDeconvolutionLayer, NETargetInfo>( + *polymorphic_downcast<DeconvolutionLayerNode *>(node), ctx); case NodeType::ConcatenateLayer: - return detail::create_concatenate_layer<NEConcatenateLayer, NETargetInfo>(*polymorphic_downcast<ConcatenateLayerNode *>(node)); + return detail::create_concatenate_layer<NEConcatenateLayer, NETargetInfo>( + *polymorphic_downcast<ConcatenateLayerNode *>(node)); case NodeType::DepthwiseConvolutionLayer: - return detail::create_depthwise_convolution_layer<NEDepthwiseConvolutionLayer, NETargetInfo>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); + return detail::create_depthwise_convolution_layer<NEDepthwiseConvolutionLayer, NETargetInfo>( + *polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DequantizationLayer: - return detail::create_dequantization_layer<NEDequantizationLayer, NETargetInfo>(*polymorphic_downcast<DequantizationLayerNode *>(node)); + return detail::create_dequantization_layer<NEDequantizationLayer, NETargetInfo>( + *polymorphic_downcast<DequantizationLayerNode *>(node)); case NodeType::DetectionOutputLayer: - return detail::create_detection_output_layer<CPPDetectionOutputLayer, NETargetInfo>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + return detail::create_detection_output_layer<CPPDetectionOutputLayer, NETargetInfo>( + *polymorphic_downcast<DetectionOutputLayerNode *>(node)); case NodeType::DetectionPostProcessLayer: - return detail::create_detection_post_process_layer<NEDetectionPostProcessLayer, NETargetInfo>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); + return detail::create_detection_post_process_layer<NEDetectionPostProcessLayer, NETargetInfo>( + *polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::EltwiseLayer: - return detail::create_eltwise_layer<NEEltwiseFunctions, NETargetInfo>(*polymorphic_downcast<EltwiseLayerNode *>(node)); + return detail::create_eltwise_layer<NEEltwiseFunctions, NETargetInfo>( + *polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::UnaryEltwiseLayer: - return detail::create_unary_eltwise_layer<NEUnaryEltwiseFunctions, NETargetInfo>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); + return detail::create_unary_eltwise_layer<NEUnaryEltwiseFunctions, NETargetInfo>( + *polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); case NodeType::FlattenLayer: - return detail::create_flatten_layer<NEFlattenLayer, NETargetInfo>(*polymorphic_downcast<FlattenLayerNode *>(node)); + return detail::create_flatten_layer<NEFlattenLayer, NETargetInfo>( + *polymorphic_downcast<FlattenLayerNode *>(node)); case NodeType::FullyConnectedLayer: - return detail::create_fully_connected_layer<NEFullyConnectedLayer, NETargetInfo>(*polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); + return detail::create_fully_connected_layer<NEFullyConnectedLayer, NETargetInfo>( + *polymorphic_downcast<FullyConnectedLayerNode *>(node), ctx); case NodeType::FusedConvolutionBatchNormalizationLayer: - return detail::create_fused_convolution_batch_normalization_layer<NEFusedLayerTypes, NETargetInfo>(*polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node), ctx); + return detail::create_fused_convolution_batch_normalization_layer<NEFusedLayerTypes, NETargetInfo>( + *polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node), ctx); case NodeType::FusedDepthwiseConvolutionBatchNormalizationLayer: - return detail::create_fused_depthwise_convolution_batch_normalization_layer<NEFusedLayerTypes, NETargetInfo>(*polymorphic_downcast<FusedDepthwiseConvolutionBatchNormalizationNode *>(node), ctx); + return detail::create_fused_depthwise_convolution_batch_normalization_layer<NEFusedLayerTypes, + NETargetInfo>( + *polymorphic_downcast<FusedDepthwiseConvolutionBatchNormalizationNode *>(node), ctx); case NodeType::L2NormalizeLayer: - return detail::create_l2_normalize_layer<NEL2NormalizeLayer, NETargetInfo>(*polymorphic_downcast<L2NormalizeLayerNode *>(node), ctx); + return detail::create_l2_normalize_layer<NEL2NormalizeLayer, NETargetInfo>( + *polymorphic_downcast<L2NormalizeLayerNode *>(node), ctx); case NodeType::NormalizationLayer: - return detail::create_normalization_layer<NENormalizationLayer, NETargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx); + return detail::create_normalization_layer<NENormalizationLayer, NETargetInfo>( + *polymorphic_downcast<NormalizationLayerNode *>(node), ctx); case NodeType::PadLayer: return detail::create_pad_layer<NEPadLayer, NETargetInfo>(*polymorphic_downcast<PadLayerNode *>(node)); case NodeType::PermuteLayer: - return detail::create_permute_layer<NEPermute, NETargetInfo>(*polymorphic_downcast<PermuteLayerNode *>(node)); + return detail::create_permute_layer<NEPermute, NETargetInfo>( + *polymorphic_downcast<PermuteLayerNode *>(node)); case NodeType::PoolingLayer: - return detail::create_pooling_layer<NEPoolingLayer, NETargetInfo>(*polymorphic_downcast<PoolingLayerNode *>(node)); + return detail::create_pooling_layer<NEPoolingLayer, NETargetInfo>( + *polymorphic_downcast<PoolingLayerNode *>(node)); case NodeType::PReluLayer: - return detail::create_prelu_layer<NEPReluLayer, NETargetInfo>(*polymorphic_downcast<PReluLayerNode *>(node)); + return detail::create_prelu_layer<NEPReluLayer, NETargetInfo>( + *polymorphic_downcast<PReluLayerNode *>(node)); case NodeType::PrintLayer: return detail::create_print_layer<NETargetInfo>(*polymorphic_downcast<PrintLayerNode *>(node)); case NodeType::PriorBoxLayer: - return detail::create_priorbox_layer<NEPriorBoxLayer, NETargetInfo>(*polymorphic_downcast<PriorBoxLayerNode *>(node)); + return detail::create_priorbox_layer<NEPriorBoxLayer, NETargetInfo>( + *polymorphic_downcast<PriorBoxLayerNode *>(node)); case NodeType::QuantizationLayer: - return detail::create_quantization_layer<NEQuantizationLayer, NETargetInfo>(*polymorphic_downcast<QuantizationLayerNode *>(node)); + return detail::create_quantization_layer<NEQuantizationLayer, NETargetInfo>( + *polymorphic_downcast<QuantizationLayerNode *>(node)); case NodeType::ReductionOperationLayer: - return detail::create_reduction_operation_layer<NEReductionOperation, NETargetInfo>(*polymorphic_downcast<ReductionLayerNode *>(node), ctx); + return detail::create_reduction_operation_layer<NEReductionOperation, NETargetInfo>( + *polymorphic_downcast<ReductionLayerNode *>(node), ctx); case NodeType::ReorgLayer: - return detail::create_reorg_layer<NEReorgLayer, NETargetInfo>(*polymorphic_downcast<ReorgLayerNode *>(node)); + return detail::create_reorg_layer<NEReorgLayer, NETargetInfo>( + *polymorphic_downcast<ReorgLayerNode *>(node)); case NodeType::ReshapeLayer: - return detail::create_reshape_layer<NEReshapeLayer, NETargetInfo>(*polymorphic_downcast<ReshapeLayerNode *>(node)); + return detail::create_reshape_layer<NEReshapeLayer, NETargetInfo>( + *polymorphic_downcast<ReshapeLayerNode *>(node)); case NodeType::ResizeLayer: return detail::create_resize_layer<NEScale, NETargetInfo>(*polymorphic_downcast<ResizeLayerNode *>(node)); case NodeType::SliceLayer: return detail::create_slice_layer<NESlice, NETargetInfo>(*polymorphic_downcast<SliceLayerNode *>(node)); case NodeType::SoftmaxLayer: - return detail::create_softmax_layer<NESoftmaxLayer, NETargetInfo>(*polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); + return detail::create_softmax_layer<NESoftmaxLayer, NETargetInfo>( + *polymorphic_downcast<SoftmaxLayerNode *>(node), ctx); case NodeType::StackLayer: - return detail::create_stack_layer<NEStackLayer, NETargetInfo>(*polymorphic_downcast<StackLayerNode *>(node)); + return detail::create_stack_layer<NEStackLayer, NETargetInfo>( + *polymorphic_downcast<StackLayerNode *>(node)); case NodeType::StridedSliceLayer: - return detail::create_strided_slice_layer<NEStridedSlice, NETargetInfo>(*polymorphic_downcast<StridedSliceLayerNode *>(node)); + return detail::create_strided_slice_layer<NEStridedSlice, NETargetInfo>( + *polymorphic_downcast<StridedSliceLayerNode *>(node)); default: return nullptr; } diff --git a/src/graph/backends/NEON/NENodeValidator.cpp b/src/graph/backends/NEON/NENodeValidator.cpp index a485e5d235..a97806f92c 100644 --- a/src/graph/backends/NEON/NENodeValidator.cpp +++ b/src/graph/backends/NEON/NENodeValidator.cpp @@ -25,9 +25,9 @@ #include "arm_compute/graph/backends/ValidateHelpers.h" #include "arm_compute/graph/nodes/Nodes.h" - #include "arm_compute/runtime/CPP/CPPFunctions.h" #include "arm_compute/runtime/NEON/NEFunctions.h" + #include "support/Cast.h" using namespace arm_compute::utils::cast; @@ -56,41 +56,51 @@ struct NEUnaryEltwiseLayerFunctions Status NENodeValidator::validate(INode *node) { - if(node == nullptr) + if (node == nullptr) { return Status{}; } NodeType type = node->type(); - switch(type) + switch (type) { case NodeType::ArgMinMaxLayer: - return detail::validate_arg_min_max_layer<NEArgMinMaxLayer>(*polymorphic_downcast<ArgMinMaxLayerNode *>(node)); + return detail::validate_arg_min_max_layer<NEArgMinMaxLayer>( + *polymorphic_downcast<ArgMinMaxLayerNode *>(node)); case NodeType::BoundingBoxTransformLayer: - return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : BoundingBoxTransformLayer"); + return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, + "Unsupported operation : BoundingBoxTransformLayer"); case NodeType::ChannelShuffleLayer: - return detail::validate_channel_shuffle_layer<NEChannelShuffleLayer>(*polymorphic_downcast<ChannelShuffleLayerNode *>(node)); + return detail::validate_channel_shuffle_layer<NEChannelShuffleLayer>( + *polymorphic_downcast<ChannelShuffleLayerNode *>(node)); case NodeType::ConvolutionLayer: - return detail::validate_convolution_layer<NEConvolutionLayer, - NEDirectConvolutionLayer, - NEGEMMConvolutionLayer, - NEWinogradConvolutionLayer>(*polymorphic_downcast<ConvolutionLayerNode *>(node)); + return detail::validate_convolution_layer<NEConvolutionLayer, NEDirectConvolutionLayer, + NEGEMMConvolutionLayer, NEWinogradConvolutionLayer>( + *polymorphic_downcast<ConvolutionLayerNode *>(node)); case NodeType::DepthToSpaceLayer: - return detail::validate_depth_to_space_layer<NEDepthToSpaceLayer>(*polymorphic_downcast<DepthToSpaceLayerNode *>(node)); + return detail::validate_depth_to_space_layer<NEDepthToSpaceLayer>( + *polymorphic_downcast<DepthToSpaceLayerNode *>(node)); case NodeType::DepthwiseConvolutionLayer: - return detail::validate_depthwise_convolution_layer<NEDepthwiseConvolutionLayer>(*polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); + return detail::validate_depthwise_convolution_layer<NEDepthwiseConvolutionLayer>( + *polymorphic_downcast<DepthwiseConvolutionLayerNode *>(node)); case NodeType::DequantizationLayer: - return detail::validate_dequantization_layer<NEDequantizationLayer>(*polymorphic_downcast<DequantizationLayerNode *>(node)); + return detail::validate_dequantization_layer<NEDequantizationLayer>( + *polymorphic_downcast<DequantizationLayerNode *>(node)); case NodeType::DetectionOutputLayer: - return detail::validate_detection_output_layer<CPPDetectionOutputLayer>(*polymorphic_downcast<DetectionOutputLayerNode *>(node)); + return detail::validate_detection_output_layer<CPPDetectionOutputLayer>( + *polymorphic_downcast<DetectionOutputLayerNode *>(node)); case NodeType::DetectionPostProcessLayer: - return detail::validate_detection_post_process_layer<NEDetectionPostProcessLayer>(*polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); + return detail::validate_detection_post_process_layer<NEDetectionPostProcessLayer>( + *polymorphic_downcast<DetectionPostProcessLayerNode *>(node)); case NodeType::GenerateProposalsLayer: - return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : GenerateProposalsLayer"); + return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, + "Unsupported operation : GenerateProposalsLayer"); case NodeType::L2NormalizeLayer: - return detail::validate_l2_normalize_layer<NEL2NormalizeLayer>(*polymorphic_downcast<L2NormalizeLayerNode *>(node)); + return detail::validate_l2_normalize_layer<NEL2NormalizeLayer>( + *polymorphic_downcast<L2NormalizeLayerNode *>(node)); case NodeType::NormalizePlanarYUVLayer: - return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : NormalizePlanarYUVLayer"); + return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, + "Unsupported operation : NormalizePlanarYUVLayer"); case NodeType::PadLayer: return detail::validate_pad_layer<NEPadLayer>(*polymorphic_downcast<PadLayerNode *>(node)); case NodeType::PermuteLayer: @@ -100,23 +110,29 @@ Status NENodeValidator::validate(INode *node) case NodeType::PriorBoxLayer: return detail::validate_priorbox_layer<NEPriorBoxLayer>(*polymorphic_downcast<PriorBoxLayerNode *>(node)); case NodeType::QuantizationLayer: - return detail::validate_quantization_layer<NEQuantizationLayer>(*polymorphic_downcast<QuantizationLayerNode *>(node)); + return detail::validate_quantization_layer<NEQuantizationLayer>( + *polymorphic_downcast<QuantizationLayerNode *>(node)); case NodeType::ReductionOperationLayer: - return detail::validate_reduction_operation_layer<NEReductionOperation>(*polymorphic_downcast<ReductionLayerNode *>(node)); + return detail::validate_reduction_operation_layer<NEReductionOperation>( + *polymorphic_downcast<ReductionLayerNode *>(node)); case NodeType::ReorgLayer: return detail::validate_reorg_layer<NEReorgLayer>(*polymorphic_downcast<ReorgLayerNode *>(node)); case NodeType::ReshapeLayer: return detail::validate_reshape_layer<NEReshapeLayer>(*polymorphic_downcast<ReshapeLayerNode *>(node)); case NodeType::ROIAlignLayer: - return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported operation : ROIAlignLayer"); + return ARM_COMPUTE_CREATE_ERROR(arm_compute::ErrorCode::RUNTIME_ERROR, + "Unsupported operation : ROIAlignLayer"); case NodeType::SliceLayer: return detail::validate_slice_layer<NESlice>(*polymorphic_downcast<SliceLayerNode *>(node)); case NodeType::StridedSliceLayer: - return detail::validate_strided_slice_layer<NEStridedSlice>(*polymorphic_downcast<StridedSliceLayerNode *>(node)); + return detail::validate_strided_slice_layer<NEStridedSlice>( + *polymorphic_downcast<StridedSliceLayerNode *>(node)); case NodeType::EltwiseLayer: - return detail::validate_eltwise_Layer<NEEltwiseLayerFunctions>(*polymorphic_downcast<EltwiseLayerNode *>(node)); + return detail::validate_eltwise_Layer<NEEltwiseLayerFunctions>( + *polymorphic_downcast<EltwiseLayerNode *>(node)); case NodeType::UnaryEltwiseLayer: - return detail::validate_unary_eltwise_layer<NEUnaryEltwiseLayerFunctions>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); + return detail::validate_unary_eltwise_layer<NEUnaryEltwiseLayerFunctions>( + *polymorphic_downcast<UnaryEltwiseLayerNode *>(node)); default: return Status{}; } diff --git a/src/graph/backends/NEON/NESubTensorHandle.cpp b/src/graph/backends/NEON/NESubTensorHandle.cpp index 36f29d0d10..8964a00c5e 100644 --- a/src/graph/backends/NEON/NESubTensorHandle.cpp +++ b/src/graph/backends/NEON/NESubTensorHandle.cpp @@ -29,7 +29,10 @@ namespace graph { namespace backends { -NESubTensorHandle::NESubTensorHandle(ITensorHandle *parent_handle, const TensorShape &shape, const Coordinates &coords, bool extend_parent) +NESubTensorHandle::NESubTensorHandle(ITensorHandle *parent_handle, + const TensorShape &shape, + const Coordinates &coords, + bool extend_parent) : _sub_tensor(), _parent_handle(nullptr) { ARM_COMPUTE_ERROR_ON(!parent_handle); @@ -95,4 +98,4 @@ Target NESubTensorHandle::target() const } } // namespace backends } // namespace graph -} // namespace arm_compute
\ No newline at end of file +} // namespace arm_compute diff --git a/src/graph/backends/NEON/NETensorHandle.cpp b/src/graph/backends/NEON/NETensorHandle.cpp index 4393156e8a..dabf67060d 100644 --- a/src/graph/backends/NEON/NETensorHandle.cpp +++ b/src/graph/backends/NEON/NETensorHandle.cpp @@ -24,6 +24,7 @@ #include "arm_compute/graph/backends/NEON/NETensorHandle.h" #include "arm_compute/runtime/MemoryGroup.h" + #include "support/Cast.h" namespace arm_compute @@ -32,8 +33,7 @@ namespace graph { namespace backends { -NETensorHandle::NETensorHandle(const ITensorInfo &info) - : _tensor() +NETensorHandle::NETensorHandle(const ITensorInfo &info) : _tensor() { _tensor.allocator()->init(info); } @@ -50,7 +50,7 @@ void NETensorHandle::free() void NETensorHandle::manage(IMemoryGroup *mg) { - if(mg != nullptr) + if (mg != nullptr) { mg->manage(&_tensor); } @@ -68,7 +68,7 @@ void NETensorHandle::unmap() void NETensorHandle::release_if_unused() { // TODO (geopin01): Release tensor only if all sub-tensors are marked as not used - if(!_tensor.is_used()) + if (!_tensor.is_used()) { _tensor.allocator()->free(); } @@ -100,4 +100,4 @@ Target NETensorHandle::target() const } } // namespace backends } // namespace graph -} // namespace arm_compute
\ No newline at end of file +} // namespace arm_compute |