ArmNN
 21.02
TensorHandleFactoryRegistry Class Reference

#include <TensorHandleFactoryRegistry.hpp>

Public Member Functions

 TensorHandleFactoryRegistry ()=default
 
 TensorHandleFactoryRegistry (const TensorHandleFactoryRegistry &other)=delete
 
 TensorHandleFactoryRegistry (TensorHandleFactoryRegistry &&other)=delete
 
void RegisterFactory (std::unique_ptr< ITensorHandleFactory > allocator)
 Register a TensorHandleFactory and transfer ownership. More...
 
void RegisterMemoryManager (std::shared_ptr< IMemoryManager > memoryManger)
 Register a memory manager with shared ownership. More...
 
ITensorHandleFactoryGetFactory (ITensorHandleFactory::FactoryId id) const
 Find a TensorHandleFactory by Id Returns nullptr if not found. More...
 
void AquireMemory ()
 Aquire memory required for inference. More...
 
void ReleaseMemory ()
 Release memory required for inference. More...
 

Detailed Description

Definition at line 20 of file TensorHandleFactoryRegistry.hpp.

Constructor & Destructor Documentation

◆ TensorHandleFactoryRegistry() [1/3]

◆ TensorHandleFactoryRegistry() [2/3]

◆ TensorHandleFactoryRegistry() [3/3]

Member Function Documentation

◆ AquireMemory()

void AquireMemory ( )

Aquire memory required for inference.

Definition at line 52 of file TensorHandleFactoryRegistry.cpp.

53 {
54  for (auto& mgr : m_MemoryManagers)
55  {
56  mgr->Acquire();
57  }
58 }

◆ GetFactory()

Find a TensorHandleFactory by Id Returns nullptr if not found.

Definition at line 39 of file TensorHandleFactoryRegistry.cpp.

Referenced by Graph::AddCompatibilityLayers(), armnn::CalculateEdgeStrategy(), armnn::CalculateSlotOption(), armnn::CalculateSlotOptionForInput(), ConcatLayer::CreateTensorHandles(), SplitterLayer::CreateTensorHandles(), Layer::CreateTensorHandles(), SplitterLayer::CreateWorkload(), ConcatLayer::CreateWorkload(), and armnn::RequiresCopy().

40 {
41  for (auto& factory : m_Factories)
42  {
43  if (factory->GetId() == id)
44  {
45  return factory.get();
46  }
47  }
48 
49  return nullptr;
50 }

◆ RegisterFactory()

void RegisterFactory ( std::unique_ptr< ITensorHandleFactory allocator)

Register a TensorHandleFactory and transfer ownership.

Definition at line 12 of file TensorHandleFactoryRegistry.cpp.

Referenced by ClBackend::CreateWorkloadFactory(), NeonBackend::CreateWorkloadFactory(), RefBackend::CreateWorkloadFactory(), MockImportBackend::CreateWorkloadFactory(), ClBackend::RegisterTensorHandleFactories(), RefBackend::RegisterTensorHandleFactories(), NeonBackend::RegisterTensorHandleFactories(), MockImportBackend::RegisterTensorHandleFactories(), and sdb::SampleDynamicBackendId().

13 {
14  if (!newFactory)
15  {
16  return;
17  }
18 
19  ITensorHandleFactory::FactoryId id = newFactory->GetId();
20 
21  // Don't register duplicates
22  for (auto& registeredFactory : m_Factories)
23  {
24  if (id == registeredFactory->GetId())
25  {
26  return;
27  }
28  }
29 
30  // Take ownership of the new allocator
31  m_Factories.push_back(std::move(newFactory));
32 }

◆ RegisterMemoryManager()

◆ ReleaseMemory()

void ReleaseMemory ( )

Release memory required for inference.

Definition at line 60 of file TensorHandleFactoryRegistry.cpp.

61 {
62  for (auto& mgr : m_MemoryManagers)
63  {
64  mgr->Release();
65  }
66 }

The documentation for this class was generated from the following files: