24.08
|
Go to the documentation of this file.
29 delete static_cast<const T*
>(blob);
41 return std::make_unique<TosaRefWorkloadFactory>(PolymorphicPointerDowncast<TosaRefMemoryManager>(memoryManager));
47 auto memoryManager = std::make_shared<TosaRefMemoryManager>();
51 auto factory = std::make_unique<TosaRefTensorHandleFactory>(memoryManager);
57 return std::make_unique<TosaRefWorkloadFactory>(PolymorphicPointerDowncast<TosaRefMemoryManager>(memoryManager));
73 return std::make_unique<TosaRefMemoryManager>();
87 auto handler = std::make_unique<TosaSerializationHandler>();
89 std::vector<std::string> graphInputs;
90 std::vector<std::string> graphOutputs;
92 std::vector<TosaSerializationOperator*> operators;
93 std::vector<TosaSerializationTensor*> tensors;
95 auto it = subgraph.
begin();
96 while (it != subgraph.
end())
98 Layer& base = *(PolymorphicDowncast<Layer*>(*it));
111 for (
const std::string& blockInputName : mappings->GetInputs())
113 if (blockInputName.find(
"input") != std::string::npos)
115 graphInputs.push_back(blockInputName);
121 for (
const std::string& blockOutputName : mappings->GetOutputs())
123 if (blockOutputName.find(
"output") != std::string::npos)
125 graphOutputs.push_back(blockOutputName);
129 auto blockOperators = mappings->GetOperators();
130 operators.insert(operators.end(), blockOperators.begin(), blockOperators.end());
132 auto blockTensors = mappings->GetTensors();
133 tensors.insert(tensors.end(), blockTensors.begin(), blockTensors.end());
139 auto* block =
new TosaSerializationBasicBlock(
"main",
"main", operators, tensors, graphInputs, graphOutputs);
141 std::vector<TosaSerializationBasicBlock*> blocks;
142 blocks.emplace_back(block);
145 auto* region =
new TosaSerializationRegion(
"main", blocks);
146 handler->GetRegions().emplace_back(region);
149 std::make_unique<PreCompiledObjectPtr>(handler.release(), DeleteAsType<TosaSerializationHandler>);
153 std::move(*compiledBlob),
155 "TOSA_Pre_Compiled_Layer");
164 return optimizationViews;
175 auto memoryManager = std::make_shared<TosaRefMemoryManager>();
179 auto factory = std::make_unique<TosaRefTensorHandleFactory>(memoryManager);
189 return std::make_unique<DefaultAllocator>();
std::vector< ITensorHandleFactory::FactoryId > GetHandleFactoryPreferences() const override
(Optional) Returns a vector of supported TensorHandleFactory ids in preference order.
constexpr const char * TosaRefBackendId()
std::shared_ptr< IMemoryManager > IMemoryManagerSharedPtr
IBackendInternal::IWorkloadFactoryPtr CreateWorkloadFactory(const IBackendInternal::IMemoryManagerSharedPtr &memoryManager=nullptr) const override
OptimizationViews OptimizeSubgraphView(const SubgraphView &subgraph, const ModelOptions &modelOptions) const override
const IOutputSlot * GetIOutputSlot(unsigned int index) const
void RegisterMemoryManager(std::shared_ptr< IMemoryManager > memoryManger)
Register a memory manager with shared ownership.
unsigned int GetNumInputSlots() const
virtual const TensorInfo & GetTensorInfo() const =0
std::unique_ptr< IBackendContext > IBackendContextPtr
IBackendInternal::ILayerSupportSharedPtr GetLayerSupport() const override
TosaSerializationBasicBlock * GetTosaMappingFromLayer(const Layer *layer)
void RegisterTensorHandleFactories(class TensorHandleFactoryRegistry ®istry) override
(Optional) Register TensorHandleFactories Either this method or CreateMemoryManager() and IWorkloadFa...
const BackendId & GetId() const override
IConnectableLayerIterator begin()
IConnectableLayer * AddPrecompiledLayer(const PreCompiledDescriptor &preCompiledDescriptor, CompiledBlobPtr compiledBlobPtr, const Optional< BackendId > &backend, const char *name=nullptr)
Adds a Precompiled layer to the network.
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
std::unique_ptr< ICustomAllocator > GetDefaultAllocator() const override
Returns the default memory allocator for the backend.
The SubgraphView class represents a subgraph of a Graph.
IBackendInternal::IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions &creationOptions, IBackendProfilingPtr &backendProfiling) override
Create context specifically used for profiling interaction from backends.
static const FactoryId & GetIdStatic()
void AddSubstitution(SubstitutionPair &&substitution)
static const BackendId & GetIdStatic()
IBackendInternal::IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions &) const override
Create the runtime context of the backend.
std::shared_ptr< arm::pipe::IBackendProfilingContext > IBackendProfilingContextPtr
This is the bridge between backend and backend profiling we'll keep it in the backend namespace.
void DeleteAsType(const void *const blob)
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
unsigned int GetNumOutputSlots() const
std::unique_ptr< arm::pipe::IBackendProfiling > IBackendProfilingPtr
std::unique_ptr< IMemoryManager > IMemoryManagerUniquePtr
IConnectableLayerIterator end()
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
Copyright (c) 2021 ARM Limited and Contributors.
void RegisterFactory(std::unique_ptr< ITensorHandleFactory > allocator)
Register a TensorHandleFactory and transfer ownership.
std::shared_ptr< ILayerSupport > ILayerSupportSharedPtr
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
void RegisterCopyAndImportFactoryPair(ITensorHandleFactory::FactoryId copyFactoryId, ITensorHandleFactory::FactoryId importFactoryId)
Register a pair of TensorHandleFactory Id for Memory Copy and TensorHandleFactory Id for Memory Impor...
std::vector< BackendOptions > ModelOptions
A PreCompiledDescriptor for the PreCompiledLayer.
std::unique_ptr< IWorkloadFactory > IWorkloadFactoryPtr
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override