44 return IsLayerSupported(&layer);
52 const std::string layerName(layer->
GetName());
53 bool optimizable = layerName.find(
"unoptimizable") == std::string::npos;
60 return IsLayerOptimizable(&layer);
85 std::cerr <<
"could not deregister mock backend" << std::endl;
110 std::shared_ptr<armnn::MockBackendProfilingContext> context =
111 std::make_shared<MockBackendProfilingContext>(backendProfiling);
139 std::for_each(subgraphLayers.begin(),
140 subgraphLayers.end(),
143 bool supported = IsLayerSupported(layer);
147 bool optimizable = IsLayerOptimizable(layer);
151 supportedLayers.push_back(layer);
156 untouchedLayers.push_back(layer);
162 unsupportedLayers.push_back(layer);
167 if (!supportedLayers.empty())
170 auto supportedSubgraphSelector = [](
const Layer& layer)
174 IsLayerSupported(layer) &&
175 IsLayerOptimizable(layer);
184 std::for_each(supportedSubgraphs.begin(),
185 supportedSubgraphs.end(),
193 supportedSubgraph->GetNumOutputSlots()),
200 optimizationViews.
AddSubstitution({ substitutionSubgraph, replacementSubgraph });
205 if (!unsupportedLayers.empty())
208 auto unsupportedSubgraphSelector = [](
const Layer& layer)
212 !IsLayerSupported(layer);
221 std::for_each(unsupportedSubgraphs.begin(),
222 unsupportedSubgraphs.end(),
232 if (!untouchedLayers.empty())
235 auto untouchedSubgraphSelector = [](
const Layer& layer)
239 IsLayerSupported(layer) &&
240 !IsLayerOptimizable(layer);
249 std::for_each(untouchedSubgraphs.begin(),
250 untouchedSubgraphs.end(),
259 return optimizationViews;
264 return std::make_unique<DefaultAllocator>();
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
void SetProfilingContextPtr(std::shared_ptr< MockBackendProfilingContext > shared)
void Register(const BackendId &id, FactoryFunction factory)
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
~MockBackendInitialiser()
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
void AddSubstitution(SubstitutionPair &&substitution)
constexpr const char * MockBackendId()
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
BackendRegistry & BackendRegistryInstance()
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph) const override
Copyright (c) 2021 ARM Limited and Contributors.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
void IgnoreUnused(Ts &&...)
void SetBackendId(const BackendId &id)
The SubgraphView class represents a subgraph of a Graph.
std::unique_ptr< armnn::profiling::IBackendProfiling > IBackendProfilingPtr
std::unique_ptr< SubgraphView > SubgraphViewPtr
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
static const BackendId & GetIdStatic()
void AddFailedSubgraph(SubgraphView &&subgraph)
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
std::vector< SubgraphViewPtr > Subgraphs
#define ARMNN_ASSERT(COND)
static MockBackendProfilingService & Instance()
void AddUntouchedSubgraph(SubgraphView &&subgraph)
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
static Subgraphs SelectSubgraphs(Graph &graph, const LayerSelectorFunction &selector)
Selects subgraphs from a graph based on the selector function and the algorithm.
void Deregister(const BackendId &id)
const Layers & GetLayers() const
const char * GetName() const override
Returns the name of the layer.
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
A PreCompiledDescriptor for the PreCompiledLayer.
std::list< Layer * > Layers
std::shared_ptr< armnn::profiling::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace...
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...
std::unique_ptr< IBackendContext > IBackendContextPtr