aboutsummaryrefslogtreecommitdiff
path: root/src/graph/backends
diff options
context:
space:
mode:
authorSheri Zhang <sheri.zhang@arm.com>2020-05-27 15:03:48 +0100
committerSheri Zhang <sheri.zhang@arm.com>2020-06-16 13:12:48 +0000
commit16dddd2af57a71ca10d62a4412d014f859720d2c (patch)
tree6478e50fc7b72775f781562508bfaf87e6d935a9 /src/graph/backends
parentbcd2352d7fd99a2f6aab220fa0c3b3f3119a1a4c (diff)
downloadComputeLibrary-16dddd2af57a71ca10d62a4412d014f859720d2c.tar.gz
COMPMID-3381: Implement graph example for YoLo v3 output detector
Add sub/exp/splitv support in graph api Signed-off-by: Sheri Zhang <sheri.zhang@arm.com> Change-Id: I4e08cc19a46655717068b12c93d67e619a595d9a Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3309 Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/graph/backends')
-rw-r--r--src/graph/backends/CL/CLFunctionsFactory.cpp8
-rw-r--r--src/graph/backends/CL/CLNodeValidator.cpp18
-rw-r--r--src/graph/backends/NEON/NEFunctionFactory.cpp12
-rw-r--r--src/graph/backends/NEON/NENodeValidator.cpp18
4 files changed, 54 insertions, 2 deletions
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<IFunction> CLFunctionFactory::create(INode *node, GraphContext &
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));
+ case NodeType::UnaryEltwiseLayer:
+ 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));
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<CLUpsampleLayer>(*polymorphic_downcast<UpsampleLayerNode *>(node));
case NodeType::YOLOLayer:
return detail::validate_yolo_layer<CLYOLOLayer>(*polymorphic_downcast<YOLOLayerNode *>(node));
+ case NodeType::EltwiseLayer:
+ return detail::validate_eltwise_Layer<CLEltwiseLayerFunctions>(*polymorphic_downcast<EltwiseLayerNode *>(node));
+ case NodeType::UnaryEltwiseLayer:
+ return detail::validate_unary_eltwise_layer<CLUnaryEltwiseLayerFunctions>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(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<IFunction> NEFunctionFactory::create(INode *node, GraphContext &
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));
+ case NodeType::UnaryEltwiseLayer:
+ 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));
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<NEUpsampleLayer>(*polymorphic_downcast<UpsampleLayerNode *>(node));
case NodeType::YOLOLayer:
return detail::validate_yolo_layer<NEYOLOLayer>(*polymorphic_downcast<YOLOLayerNode *>(node));
+ case NodeType::EltwiseLayer:
+ return detail::validate_eltwise_Layer<NEEltwiseLayerFunctions>(*polymorphic_downcast<EltwiseLayerNode *>(node));
+ case NodeType::UnaryEltwiseLayer:
+ return detail::validate_unary_eltwise_layer<NEUnaryEltwiseLayerFunctions>(*polymorphic_downcast<UnaryEltwiseLayerNode *>(node));
default:
return Status{};
}