aboutsummaryrefslogtreecommitdiff
path: root/src/graph/backends
diff options
context:
space:
mode:
authorgiuros01 <giuseppe.rossini@arm.com>2019-02-21 17:32:34 +0000
committerGiuseppe Rossini <giuseppe.rossini@arm.com>2019-03-13 10:31:18 +0000
commitacce504ec4aebe5e5da470c1cfc3cee401ff11f3 (patch)
treebff9107fe7facf4be68140380192ee1ea049d05d /src/graph/backends
parentba5e096b8b2a9f777695844746ec3ff1ef90ade8 (diff)
downloadComputeLibrary-acce504ec4aebe5e5da470c1cfc3cee401ff11f3.tar.gz
COMPMID-1740: Fuse batch normalization with Convolution Layer at graph level
Change-Id: I77ca51c2c72783cc26a099a6a9c3210cdbbe822d Signed-off-by: giuros01 <giuseppe.rossini@arm.com> Reviewed-on: https://review.mlplatform.org/c/797 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/graph/backends')
-rw-r--r--src/graph/backends/CL/CLFunctionsFactory.cpp13
-rw-r--r--src/graph/backends/NEON/NEFunctionFactory.cpp14
2 files changed, 24 insertions, 3 deletions
diff --git a/src/graph/backends/CL/CLFunctionsFactory.cpp b/src/graph/backends/CL/CLFunctionsFactory.cpp
index b9e3ddc0a3..7473ff480f 100644
--- a/src/graph/backends/CL/CLFunctionsFactory.cpp
+++ b/src/graph/backends/CL/CLFunctionsFactory.cpp
@@ -40,7 +40,8 @@ namespace backends
/** Target specific information structure used to pass information to the layer templates */
struct CLTargetInfo
{
- using TensorType = arm_compute::ICLTensor;
+ using TensorType = arm_compute::ICLTensor;
+ using TensorConcreteType = CLTensor;
static Target TargetType;
};
@@ -69,6 +70,14 @@ struct CLEltwiseFunctions
using Subtraction = CLArithmeticSubtraction;
using Multiplication = CLPixelWiseMultiplication;
};
+
+/** Function and tensor types to be used inside a CL fused convolution/batch normalization layer */
+struct CLFusedLayerTypes
+{
+ using ConvolutionLayer = CLConvolutionLayer;
+ using FuseBatchNormalization = CLFuseBatchNormalization;
+};
+
// TODO (isagot01): Remove once we support heterogeneous scheduling at function level
/** Wrapper for the CPP Function in the OpenCL backend **/
class CPPWrapperFunction : public IFunction
@@ -192,6 +201,8 @@ std::unique_ptr<IFunction> CLFunctionFactory::create(INode *node, GraphContext &
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);
+ case NodeType::FusedConvolutionBatchNormalizationLayer:
+ return detail::create_fused_convolution_batch_normalization_layer<CLFusedLayerTypes, CLTargetInfo>(*polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node));
case NodeType::GenerateProposalsLayer:
return detail::create_generate_proposals_layer<CLGenerateProposalsLayer, CLTargetInfo>(*polymorphic_downcast<GenerateProposalsLayerNode *>(node), ctx);
case NodeType::NormalizationLayer:
diff --git a/src/graph/backends/NEON/NEFunctionFactory.cpp b/src/graph/backends/NEON/NEFunctionFactory.cpp
index dc987dd86e..f23845c314 100644
--- a/src/graph/backends/NEON/NEFunctionFactory.cpp
+++ b/src/graph/backends/NEON/NEFunctionFactory.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -46,7 +46,8 @@ namespace backends
/** Target specific information structure used to pass information to the layer templates */
struct NETargetInfo
{
- using TensorType = arm_compute::ITensor;
+ using TensorType = arm_compute::ITensor;
+ using TensorConcreteType = arm_compute::Tensor;
static Target TargetType;
};
@@ -76,6 +77,13 @@ struct NEEltwiseFunctions
using Multiplication = NEPixelWiseMultiplication;
};
+/** Function and tensor types to be used inside a NEON fused convolution/batch normalization layer */
+struct NEFusedLayerTypes
+{
+ using ConvolutionLayer = NEConvolutionLayer;
+ using FuseBatchNormalization = NEFuseBatchNormalization;
+};
+
namespace detail
{
// Specialized functions
@@ -210,6 +218,8 @@ std::unique_ptr<IFunction> NEFunctionFactory::create(INode *node, GraphContext &
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);
+ case NodeType::FusedConvolutionBatchNormalizationLayer:
+ return detail::create_fused_convolution_batch_normalization_layer<NEFusedLayerTypes, NETargetInfo>(*polymorphic_downcast<FusedConvolutionBatchNormalizationNode *>(node));
case NodeType::NormalizationLayer:
return detail::create_normalization_layer<NENormalizationLayer, NETargetInfo>(*polymorphic_downcast<NormalizationLayerNode *>(node), ctx);
case NodeType::PermuteLayer: