18 #include <boost/cast.hpp> 27 BOOST_ASSERT(layer !=
nullptr);
46 return IsLayerSupported(&layer);
51 BOOST_ASSERT(layer !=
nullptr);
54 const std::string layerName(layer->
GetName());
55 bool optimizable = layerName.find(
"unoptimizable") == std::string::npos;
62 return IsLayerOptimizable(&layer);
87 std::cerr <<
"could not deregister mock backend" << std::endl;
112 std::shared_ptr<armnn::MockBackendProfilingContext> context =
113 std::make_shared<MockBackendProfilingContext>(backendProfiling);
146 std::for_each(subgraphLayers.begin(),
147 subgraphLayers.end(),
150 bool supported = IsLayerSupported(layer);
154 bool optimizable = IsLayerOptimizable(layer);
158 supportedLayers.push_back(layer);
163 untouchedLayers.push_back(layer);
169 unsupportedLayers.push_back(layer);
174 if (!supportedLayers.empty())
177 auto supportedSubgraphSelector = [](
const Layer& layer)
181 IsLayerSupported(layer) &&
182 IsLayerOptimizable(layer);
191 std::for_each(supportedSubgraphs.begin(),
192 supportedSubgraphs.end(),
195 BOOST_ASSERT(supportedSubgraph !=
nullptr);
200 supportedSubgraph->GetNumOutputSlots()),
207 optimizationViews.
AddSubstitution({ substitutionSubgraph, replacementSubgraph });
212 if (!unsupportedLayers.empty())
215 auto unsupportedSubgraphSelector = [](
const Layer& layer)
219 !IsLayerSupported(layer);
228 std::for_each(unsupportedSubgraphs.begin(),
229 unsupportedSubgraphs.end(),
232 BOOST_ASSERT(unsupportedSubgraph !=
nullptr);
239 if (!untouchedLayers.empty())
242 auto untouchedSubgraphSelector = [](
const Layer& layer)
246 IsLayerSupported(layer) &&
247 !IsLayerOptimizable(layer);
256 std::for_each(untouchedSubgraphs.begin(),
257 untouchedSubgraphs.end(),
260 BOOST_ASSERT(untouchedSubgraph !=
nullptr);
266 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
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