15 #include <unordered_map> 22 namespace experimental
48 std::vector<InputMemDescriptorCoords> inputLayerInfo,
49 std::vector<OutputMemDescriptorCoords> outputLayerInfo,
50 std::vector<WorkingMemDescriptor> workingMemDescriptors,
51 std::unordered_map<LayerGuid, WorkingMemDescriptor> workingMemDescriptorMap,
52 std::unique_ptr<MemoryManager> memoryManager,
53 std::vector<std::pair<std::shared_ptr<TensorMemory>,
MemorySource>> tensorMemory,
54 std::vector<std::unique_ptr<ITensorHandle>> managedTensorHandles,
55 std::vector<std::unique_ptr<ITensorHandle>> unmanagedTensorHandles);
81 auto result = m_WorkingMemDescriptorMap.find(
id);
83 return result->second;
90 return m_WorkingMemDescriptors[id];
95 return m_InputHandleMap.at(layerBindingId);
100 return m_OutputHandleMap.at(layerBindingId);
105 return m_InputConnectionMap.at(layerBindingId);
110 return m_OutputConnectionMap.at(layerBindingId);
117 return m_BindingIdVec;
123 using DifferenceType = std::vector<ITensorHandle*>::difference_type;
126 std::unordered_map<LayerBindingId, ITensorHandle*> m_InputHandleMap;
127 std::unordered_map<LayerBindingId, ITensorHandle*> m_OutputHandleMap;
128 std::unordered_map<LayerBindingId, std::vector<std::vector<ITensorHandle*>::iterator>> m_InputConnectionMap;
129 std::unordered_map<LayerBindingId, std::vector<std::vector<ITensorHandle*>::iterator>> m_OutputConnectionMap;
131 std::vector<WorkingMemDescriptor> m_WorkingMemDescriptors;
132 std::unordered_map<LayerGuid, WorkingMemDescriptor> m_WorkingMemDescriptorMap;
134 std::unique_ptr<MemoryManager> m_MemoryManager;
137 std::vector<std::pair<std::shared_ptr<TensorMemory>,
MemorySource>> m_TensorMemory;
141 std::vector<std::unique_ptr<ITensorHandle>> m_ManagedTensorHandles;
144 std::vector<std::unique_ptr<ITensorHandle>> m_UnmanagedTensorHandles;
146 std::unordered_map<LayerBindingId, bool> m_InputValidationMap;
147 std::unordered_map<LayerBindingId, bool> m_OutputValidationMap;
149 std::vector<LayerBindingId> m_BindingIdVec;
151 DifferenceType m_InputSize;
WorkingMemDescriptor & GetWorkingMemDescriptorAt(unsigned int id) override
Get the WorkingMemDescriptor 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()
WorkingMemDescriptor & GetWorkingMemDescriptor(LayerGuid id) override
Get the WorkingMemDescriptor for a Layer.
std::pair< unsigned int, unsigned int > m_OutputSlotCoords
std::vector< LayerBindingId > m_LayerBindingIds
const std::vector< std::vector< ITensorHandle * >::iterator > & GetInputConnections(LayerBindingId layerBindingId) const
#define ARMNN_ASSERT(COND)
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.
profiling::ProfilingGuid LayerGuid
Define LayerGuid type.
ITensorHandle * GetInputHandle(LayerBindingId layerBindingId) const
void Free() override
Free the backing memory required for execution.