24.02
|
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.
end();
96 while (it != subgraph.
begin())
99 Layer& base = *(PolymorphicDowncast<Layer*>(*it));
111 for (uint32_t i = 0; i < mappings->GetInputs().size(); i++)
113 std::basic_string<char> blockInputName = mappings->GetInputs()[i];
115 if (blockInputName.find(
"input") != std::string::npos)
117 graphInputs.push_back(blockInputName);
123 for (uint32_t i = 0; i < mappings->GetOutputs().size(); i++)
125 std::basic_string<char> blockOutputName = mappings->GetOutputs()[i];
127 if (blockOutputName.find(
"output") != std::string::npos)
129 graphOutputs.push_back(blockOutputName);
133 auto blockOperators = mappings->GetOperators();
134 operators.insert(operators.end(), blockOperators.begin(), blockOperators.end());
136 auto blockTensors = mappings->GetTensors();
137 tensors.insert(tensors.end(), blockTensors.begin(), blockTensors.end());
141 auto* block =
new TosaSerializationBasicBlock(
"main",
"main", operators, tensors, graphInputs, graphOutputs);
143 std::vector<TosaSerializationBasicBlock*> blocks;
144 blocks.emplace_back(block);
147 auto* region =
new TosaSerializationRegion(
"main", blocks);
148 handler->GetRegions().emplace_back(region);
151 std::make_unique<PreCompiledObjectPtr>(handler.release(), DeleteAsType<TosaSerializationHandler>);
155 std::move(*compiledBlob),
157 "TOSA_Pre_Compiled_Layer");
166 return optimizationViews;
177 auto memoryManager = std::make_shared<TosaRefMemoryManager>();
181 auto factory = std::make_unique<TosaRefTensorHandleFactory>(memoryManager);
191 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
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
TosaSerializationBasicBlock * GetTosaMappingFromLayer(Layer *layer)
IBackendInternal::IMemoryManagerUniquePtr CreateMemoryManager() const override