17 #include <boost/cast.hpp> 45 return IsLayerSupported(&layer);
53 const std::string layerName(layer->
GetName());
54 bool optimizable = layerName.find(
"unoptimizable") == std::string::npos;
61 return IsLayerOptimizable(&layer);
86 std::cerr <<
"could not deregister mock backend" << std::endl;
111 std::shared_ptr<armnn::MockBackendProfilingContext> context =
112 std::make_shared<MockBackendProfilingContext>(backendProfiling);
145 std::for_each(subgraphLayers.begin(),
146 subgraphLayers.end(),
149 bool supported = IsLayerSupported(layer);
153 bool optimizable = IsLayerOptimizable(layer);
157 supportedLayers.push_back(layer);
162 untouchedLayers.push_back(layer);
168 unsupportedLayers.push_back(layer);
173 if (!supportedLayers.empty())
176 auto supportedSubgraphSelector = [](
const Layer& layer)
180 IsLayerSupported(layer) &&
181 IsLayerOptimizable(layer);
190 std::for_each(supportedSubgraphs.begin(),
191 supportedSubgraphs.end(),
199 supportedSubgraph->GetNumOutputSlots()),
206 optimizationViews.
AddSubstitution({ substitutionSubgraph, replacementSubgraph });
211 if (!unsupportedLayers.empty())
214 auto unsupportedSubgraphSelector = [](
const Layer& layer)
218 !IsLayerSupported(layer);
227 std::for_each(unsupportedSubgraphs.begin(),
228 unsupportedSubgraphs.end(),
238 if (!untouchedLayers.empty())
241 auto untouchedSubgraphSelector = [](
const Layer& layer)
245 IsLayerSupported(layer) &&
246 !IsLayerOptimizable(layer);
255 std::for_each(untouchedSubgraphs.begin(),
256 untouchedSubgraphs.end(),
265 return optimizationViews;
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
void SetProfilingContextPtr(std::shared_ptr< MockBackendProfilingContext > shared)
std::vector< OptimizationPtr > Optimizations
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) 2020 ARM Limited.
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
void IgnoreUnused(Ts &&...)
void SetBackendId(const BackendId &id)
IBackendInternal::Optimizations GetOptimizations() const override
The SubgraphView class represents a subgraph of a Graph.
std::unique_ptr< armnn::profiling::IBackendProfiling > IBackendProfilingPtr
std::unique_ptr< SubgraphView > SubgraphViewPtr
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
static const BackendId & GetIdStatic()
void AddFailedSubgraph(SubgraphView &&subgraph)
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
LayerType GetType() 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
armnn::Runtime::CreationOptions::ExternalProfilingOptions options
std::unique_ptr< ISubGraphConverter > supported
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
std::unique_ptr< IBackendContext > IBackendContextPtr