17 #include <unordered_map> 24 namespace experimental
27 using BackendPtrMap = std::unordered_map<BackendId, IBackendInternalUniquePtr>;
51 std::vector<InputMemDescriptorCoords> inputLayerInfo,
52 std::vector<OutputMemDescriptorCoords> outputLayerInfo,
53 std::vector<WorkingMemDescriptor> workingMemDescriptors,
54 std::unique_ptr<MemoryManager> memoryManager,
55 std::vector<std::pair<std::shared_ptr<TensorMemory>,
MemorySource>> tensorMemory,
56 std::vector<std::unique_ptr<ITensorHandle>> managedTensorHandles,
57 std::vector<std::unique_ptr<ITensorHandle>> unmanagedTensorHandles,
58 std::vector<std::pair<BackendId, ExecutionData>> executionDataVec,
86 return m_WorkingMemDescriptors[id];
94 return m_ExecutionDataVec[id];
99 return m_InputHandleMap.at(layerBindingId);
104 return m_OutputHandleMap.at(layerBindingId);
109 return m_InputConnectionMap.at(layerBindingId);
114 return m_OutputConnectionMap.at(layerBindingId);
121 return m_BindingIdVec;
127 using DifferenceType = std::vector<ITensorHandle*>::difference_type;
130 std::unordered_map<LayerBindingId, ITensorHandle*> m_InputHandleMap;
131 std::unordered_map<LayerBindingId, ITensorHandle*> m_OutputHandleMap;
132 std::unordered_map<LayerBindingId, std::vector<std::vector<ITensorHandle*>::iterator>> m_InputConnectionMap;
133 std::unordered_map<LayerBindingId, std::vector<std::vector<ITensorHandle*>::iterator>> m_OutputConnectionMap;
135 std::vector<WorkingMemDescriptor> m_WorkingMemDescriptors;
137 std::unique_ptr<MemoryManager> m_MemoryManager;
140 std::vector<std::pair<std::shared_ptr<TensorMemory>,
MemorySource>> m_TensorMemory;
143 std::vector<std::unique_ptr<ITensorHandle>> m_ManagedTensorHandles;
146 std::vector<std::unique_ptr<ITensorHandle>> m_UnmanagedTensorHandles;
148 std::unordered_map<LayerBindingId, bool> m_InputValidationMap;
149 std::unordered_map<LayerBindingId, bool> m_OutputValidationMap;
151 std::vector<LayerBindingId> m_BindingIdVec;
153 DifferenceType m_InputSize;
157 std::vector<std::pair<BackendId, ExecutionData>> m_ExecutionDataVec;
std::unordered_map< BackendId, IBackendInternalUniquePtr > BackendPtrMap
WorkingMemDescriptor & GetWorkingMemDescriptorAt(unsigned int id) override
Get the WorkingMemDescriptor at an index.
std::pair< BackendId, ExecutionData > & GetExecutionDataAt(unsigned int id) override
Get the ExecutionData at an index.
ITensorHandle * GetOutputHandle(LayerBindingId layerBindingId) const
std::vector< std::pair< unsigned int, unsigned int > > m_InputSlotCoords
Copyright (c) 2021 ARM Limited and Contributors.
NetworkId GetNetworkId() override
Returns the NetworkId of the Network that this IWorkingMemHandle works with.
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
const std::vector< std::vector< ITensorHandle * >::iterator > & GetOutputConnection(LayerBindingId layerBindingId) const
void ValidateBindingIds()
std::pair< unsigned int, unsigned int > m_OutputSlotCoords
std::vector< LayerBindingId > m_LayerBindingIds
const std::vector< std::vector< ITensorHandle * >::iterator > & GetInputConnections(LayerBindingId layerBindingId) const
WorkingMemHandle(NetworkId networkId)
void Allocate() override
Allocate the backing memory required for execution.
std::vector< LayerBindingId > & GetBindingIdVector()
bool IsAllocated() override
IsAllocated returns true if the backing memory is currently allocated.
MemorySource
Define the Memory Source to reduce copies.
ITensorHandle * GetInputHandle(LayerBindingId layerBindingId) const
void Free() override
Free the backing memory required for execution.