aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-01-11 13:25:59 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-01-15 08:59:50 +0000
commit4912402497a51c6afe0898b3900f87feefa006a6 (patch)
tree4e9b5161781d2b0be041aec17227193da5977443 /include
parentd0a1608e2c41639d8f3e3f9305d79c5f92c9cff8 (diff)
downloadarmnn-4912402497a51c6afe0898b3900f87feefa006a6.tar.gz
IVGCVSW-2454 Merge together the pluggable backends work (was in a
separate branch) and master * Brings in all the changes done for the pluggable backends * Added sub-graph support and tests * Added precompiled layer support and tests * Moved BackendSettings to a separate file * Removed the backend-specific code * Ported DebugLayer and associated functionality * Included fixes to make those changes work with master Change-Id: Id7028fa7917527b844628d5aff5732e3d94c0488
Diffstat (limited to 'include')
-rw-r--r--include/armnn/BackendId.hpp3
-rw-r--r--include/armnn/Descriptors.hpp23
-rw-r--r--include/armnn/DescriptorsFwd.hpp16
-rw-r--r--include/armnn/ILayerSupport.hpp4
-rw-r--r--include/armnn/INetwork.hpp9
-rw-r--r--include/armnn/LayerSupport.hpp6
-rw-r--r--include/armnn/TypesUtils.hpp10
7 files changed, 53 insertions, 18 deletions
diff --git a/include/armnn/BackendId.hpp b/include/armnn/BackendId.hpp
index 87206073be..129cbb5d46 100644
--- a/include/armnn/BackendId.hpp
+++ b/include/armnn/BackendId.hpp
@@ -170,7 +170,8 @@ std::ostream& operator<<(std::ostream& os,
return os;
}
-using BackendIdSet = std::unordered_set<BackendId>;
+using BackendIdVector = std::vector<BackendId>;
+using BackendIdSet = std::unordered_set<BackendId>;
} // namespace armnn
diff --git a/include/armnn/Descriptors.hpp b/include/armnn/Descriptors.hpp
index 2b30c2bcf6..4497d0da9e 100644
--- a/include/armnn/Descriptors.hpp
+++ b/include/armnn/Descriptors.hpp
@@ -18,7 +18,7 @@ namespace armnn
/// An ActivationDescriptor for the ActivationLayer.
struct ActivationDescriptor
{
- ActivationDescriptor() : m_Function(ActivationFunction::Sigmoid), m_A(0), m_B(0) {};
+ ActivationDescriptor() : m_Function(ActivationFunction::Sigmoid), m_A(0), m_B(0) {}
/// @brief The activation function to use
/// (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square).
@@ -48,7 +48,7 @@ struct PermuteDescriptor
/// A SoftmaxDescriptor for the SoftmaxLayer.
struct SoftmaxDescriptor
{
- SoftmaxDescriptor() : m_Beta(1.0f) {};
+ SoftmaxDescriptor() : m_Beta(1.0f) {}
/// Exponentiation value.
float m_Beta;
};
@@ -221,7 +221,7 @@ struct Pooling2dDescriptor
, m_OutputShapeRounding(OutputShapeRounding::Floor)
, m_PaddingMethod(PaddingMethod::Exclude)
, m_DataLayout(DataLayout::NCHW)
- {};
+ {}
/// The pooling algorithm to use (Max. Average, L2).
PoolingAlgorithm m_PoolType;
@@ -255,7 +255,7 @@ struct FullyConnectedDescriptor
FullyConnectedDescriptor()
: m_BiasEnabled(false)
, m_TransposeWeightMatrix(false)
- {};
+ {}
/// Enable/disable bias.
bool m_BiasEnabled;
@@ -275,7 +275,7 @@ struct Convolution2dDescriptor
, m_StrideY(0)
, m_BiasEnabled(false)
, m_DataLayout(DataLayout::NCHW)
- {};
+ {}
/// Padding left value in the width dimension.
uint32_t m_PadLeft;
@@ -608,4 +608,17 @@ struct DebugDescriptor
unsigned int m_SlotIndex;
};
+/// A PreCompiledDescriptor for the PreCompiledLayer.
+struct PreCompiledDescriptor
+{
+ PreCompiledDescriptor(unsigned int numInputSlots = 1u, unsigned int numOutputSlots = 1u)
+ : m_NumInputSlots(numInputSlots), m_NumOutputSlots(numOutputSlots)
+ {}
+
+ ~PreCompiledDescriptor() = default;
+
+ unsigned int m_NumInputSlots;
+ unsigned int m_NumOutputSlots;
+};
+
}
diff --git a/include/armnn/DescriptorsFwd.hpp b/include/armnn/DescriptorsFwd.hpp
index 729f739b3d..c1d21b5665 100644
--- a/include/armnn/DescriptorsFwd.hpp
+++ b/include/armnn/DescriptorsFwd.hpp
@@ -2,6 +2,7 @@
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//
+
#pragma once
namespace armnn
@@ -10,24 +11,25 @@ struct ActivationDescriptor;
struct BatchNormalizationDescriptor;
struct BatchToSpaceNdDescriptor;
struct Convolution2dDescriptor;
+struct DebugDescriptor;
struct DepthwiseConvolution2dDescriptor;
struct FakeQuantizationDescriptor;
struct FullyConnectedDescriptor;
-struct LstmDescriptor;
-struct PermuteDescriptor;
-struct NormalizationDescriptor;
struct L2NormalizationDescriptor;
+struct LstmDescriptor;
struct MeanDescriptor;
+struct NormalizationDescriptor;
+struct OriginsDescriptor;
struct PadDescriptor;
+struct PermuteDescriptor;
struct Pooling2dDescriptor;
+struct PreCompiledDescriptor;
struct ReshapeDescriptor;
-struct SpaceToBatchNdDescriptor;
struct ResizeBilinearDescriptor;
struct SoftmaxDescriptor;
-struct OriginsDescriptor;
-struct ViewsDescriptor;
+struct SpaceToBatchNdDescriptor;
struct StridedSliceDescriptor;
-struct DebugDescriptor;
+struct ViewsDescriptor;
using MergerDescriptor = OriginsDescriptor;
using SplitterDescriptor = ViewsDescriptor;
diff --git a/include/armnn/ILayerSupport.hpp b/include/armnn/ILayerSupport.hpp
index bba344975a..929896d285 100644
--- a/include/armnn/ILayerSupport.hpp
+++ b/include/armnn/ILayerSupport.hpp
@@ -189,6 +189,10 @@ public:
const Pooling2dDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0;
+ virtual bool IsPreCompiledSupported(const TensorInfo& input,
+ const PreCompiledDescriptor& descriptor,
+ Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0;
+
virtual bool IsReshapeSupported(const TensorInfo& input,
const ReshapeDescriptor& descriptor,
Optional<std::string&> reasonIfUnsupported = EmptyOptional()) const = 0;
diff --git a/include/armnn/INetwork.hpp b/include/armnn/INetwork.hpp
index 5f341ad6fa..f31176ad7c 100644
--- a/include/armnn/INetwork.hpp
+++ b/include/armnn/INetwork.hpp
@@ -364,16 +364,15 @@ protected:
struct OptimizerOptions
{
- OptimizerOptions() :
- m_ReduceFp32ToFp16(false)
- , m_Debug(false)
+ OptimizerOptions()
+ : m_ReduceFp32ToFp16(false)
+ , m_Debug(false)
{}
OptimizerOptions(bool reduceFp32ToFp16, bool debug)
: m_ReduceFp32ToFp16(reduceFp32ToFp16)
, m_Debug(debug)
- {
- }
+ {}
// Reduce Fp32 data to Fp16 for faster processing
bool m_ReduceFp32ToFp16;
diff --git a/include/armnn/LayerSupport.hpp b/include/armnn/LayerSupport.hpp
index 8286ec6109..3cf53dd844 100644
--- a/include/armnn/LayerSupport.hpp
+++ b/include/armnn/LayerSupport.hpp
@@ -252,6 +252,12 @@ bool IsPermuteSupported(const BackendId& backend,
size_t reasonIfUnsupportedMaxLength = 1024);
/// Deprecated in favor of IBackend and ILayerSupport interfaces
+bool IsPreCompiledSupported(const BackendId& backend,
+ const TensorInfo& input,
+ char* reasonIfUnsupported = nullptr,
+ size_t reasonIfUnsupportedMaxLength = 1024);
+
+/// Deprecated in favor of IBackend and ILayerSupport interfaces
bool IsPooling2dSupported(const BackendId& backend,
const TensorInfo& input,
const TensorInfo& output,
diff --git a/include/armnn/TypesUtils.hpp b/include/armnn/TypesUtils.hpp
index 7eacc00a93..8c4ceb8d4f 100644
--- a/include/armnn/TypesUtils.hpp
+++ b/include/armnn/TypesUtils.hpp
@@ -135,6 +135,16 @@ constexpr const char* GetDataTypeName(DataType dataType)
}
}
+constexpr const char* GetDataLayoutName(DataLayout dataLayout)
+{
+ switch (dataLayout)
+ {
+ case DataLayout::NCHW: return "NCHW";
+ case DataLayout::NHWC: return "NHWC";
+ default: return "Unknown";
+ }
+}
+
template<typename T>
struct IsHalfType