From 16dddd2af57a71ca10d62a4412d014f859720d2c Mon Sep 17 00:00:00 2001 From: Sheri Zhang Date: Wed, 27 May 2020 15:03:48 +0100 Subject: COMPMID-3381: Implement graph example for YoLo v3 output detector Add sub/exp/splitv support in graph api Signed-off-by: Sheri Zhang Change-Id: I4e08cc19a46655717068b12c93d67e619a595d9a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3309 Reviewed-by: Georgios Pinitas Tested-by: Arm Jenkins Comments-Addressed: Arm Jenkins --- src/graph/backends/CL/CLFunctionsFactory.cpp | 8 ++++++++ src/graph/backends/CL/CLNodeValidator.cpp | 18 ++++++++++++++++++ src/graph/backends/NEON/NEFunctionFactory.cpp | 12 ++++++++++-- src/graph/backends/NEON/NENodeValidator.cpp | 18 ++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) (limited to 'src/graph/backends') diff --git a/src/graph/backends/CL/CLFunctionsFactory.cpp b/src/graph/backends/CL/CLFunctionsFactory.cpp index 312e09a49a..cf494e9a67 100644 --- a/src/graph/backends/CL/CLFunctionsFactory.cpp +++ b/src/graph/backends/CL/CLFunctionsFactory.cpp @@ -65,6 +65,12 @@ struct CLEltwiseFunctions using Multiplication = CLPixelWiseMultiplication; }; +/** Collection of CL unary element-wise functions */ +struct CLUnaryEltwiseFunctions +{ + using Exp = CLExpLayer; +}; + /** Function and tensor types to be used inside a CL fused convolution/batch normalization layer */ struct CLFusedLayerTypes { @@ -252,6 +258,8 @@ std::unique_ptr CLFunctionFactory::create(INode *node, GraphContext & return detail::create_detection_post_process_layer(*polymorphic_downcast(node)); case NodeType::EltwiseLayer: return detail::create_eltwise_layer(*polymorphic_downcast(node)); + case NodeType::UnaryEltwiseLayer: + return detail::create_unary_eltwise_layer(*polymorphic_downcast(node)); case NodeType::FlattenLayer: return detail::create_flatten_layer(*polymorphic_downcast(node)); case NodeType::FullyConnectedLayer: diff --git a/src/graph/backends/CL/CLNodeValidator.cpp b/src/graph/backends/CL/CLNodeValidator.cpp index ddb8e3d1ac..15b54aedee 100644 --- a/src/graph/backends/CL/CLNodeValidator.cpp +++ b/src/graph/backends/CL/CLNodeValidator.cpp @@ -38,6 +38,20 @@ namespace graph { namespace backends { +/** Collection of CL element-wise functions */ +struct CLEltwiseLayerFunctions +{ + using ArithmeticAddition = CLArithmeticAddition; + using ArithmeticSubtraction = CLArithmeticSubtraction; + using PixelWiseMultiplication = CLPixelWiseMultiplication; +}; + +/** Collection of CL unary element-wise functions */ +struct CLUnaryEltwiseLayerFunctions +{ + using ExpLayer = CLExpLayer; +}; + Status CLNodeValidator::validate(INode *node) { if(node == nullptr) @@ -91,6 +105,10 @@ Status CLNodeValidator::validate(INode *node) return detail::validate_upsample_layer(*polymorphic_downcast(node)); case NodeType::YOLOLayer: return detail::validate_yolo_layer(*polymorphic_downcast(node)); + case NodeType::EltwiseLayer: + return detail::validate_eltwise_Layer(*polymorphic_downcast(node)); + case NodeType::UnaryEltwiseLayer: + return detail::validate_unary_eltwise_layer(*polymorphic_downcast(node)); default: return Status{}; } diff --git a/src/graph/backends/NEON/NEFunctionFactory.cpp b/src/graph/backends/NEON/NEFunctionFactory.cpp index 454215e7ec..0b3036cb4e 100644 --- a/src/graph/backends/NEON/NEFunctionFactory.cpp +++ b/src/graph/backends/NEON/NEFunctionFactory.cpp @@ -53,7 +53,7 @@ struct NETargetInfo Target NETargetInfo::TargetType = Target::NEON; -/** Collection of CL convolution functions */ +/** Collection of NEON convolution functions */ struct NEConvolutionLayerFunctions { using GenericConvolutionLayer = NEConvolutionLayer; @@ -62,7 +62,7 @@ struct NEConvolutionLayerFunctions using WinogradConvolutionLayer = NEWinogradConvolutionLayer; }; -/** Collection of CL element-wise functions */ +/** Collection of NEON element-wise functions */ struct NEEltwiseFunctions { using Addition = NEArithmeticAddition; @@ -70,6 +70,12 @@ struct NEEltwiseFunctions using Multiplication = NEPixelWiseMultiplication; }; +/** Collection of NEON unary element-wise functions */ +struct NEUnaryEltwiseFunctions +{ + using Exp = NEExpLayer; +}; + /** Function and tensor types to be used inside a NEON fused convolution/batch normalization layer */ struct NEFusedLayerTypes { @@ -143,6 +149,8 @@ std::unique_ptr NEFunctionFactory::create(INode *node, GraphContext & return detail::create_detection_post_process_layer(*polymorphic_downcast(node)); case NodeType::EltwiseLayer: return detail::create_eltwise_layer(*polymorphic_downcast(node)); + case NodeType::UnaryEltwiseLayer: + return detail::create_unary_eltwise_layer(*polymorphic_downcast(node)); case NodeType::FlattenLayer: return detail::create_flatten_layer(*polymorphic_downcast(node)); case NodeType::FullyConnectedLayer: diff --git a/src/graph/backends/NEON/NENodeValidator.cpp b/src/graph/backends/NEON/NENodeValidator.cpp index 0a3107292b..d4af3133be 100644 --- a/src/graph/backends/NEON/NENodeValidator.cpp +++ b/src/graph/backends/NEON/NENodeValidator.cpp @@ -38,6 +38,20 @@ namespace graph { namespace backends { +/** Collection of NEON element-wise functions */ +struct NEEltwiseLayerFunctions +{ + using ArithmeticAddition = NEArithmeticAddition; + using ArithmeticSubtraction = NEArithmeticSubtraction; + using PixelWiseMultiplication = NEPixelWiseMultiplication; +}; + +/** Collection of NEON unary element-wise functions */ +struct NEUnaryEltwiseLayerFunctions +{ + using ExpLayer = NEExpLayer; +}; + Status NENodeValidator::validate(INode *node) { if(node == nullptr) @@ -91,6 +105,10 @@ Status NENodeValidator::validate(INode *node) return detail::validate_upsample_layer(*polymorphic_downcast(node)); case NodeType::YOLOLayer: return detail::validate_yolo_layer(*polymorphic_downcast(node)); + case NodeType::EltwiseLayer: + return detail::validate_eltwise_Layer(*polymorphic_downcast(node)); + case NodeType::UnaryEltwiseLayer: + return detail::validate_unary_eltwise_layer(*polymorphic_downcast(node)); default: return Status{}; } -- cgit v1.2.1