MCPcopy Create free account
hub / github.com/ARM-software/armnn / Import

Method Import

src/armnnTestUtils/MockTensorHandle.cpp:114–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112}
113
114bool MockTensorHandle::Import(void* memory, MemorySource source)
115{
116 if (m_ImportFlags & static_cast<MemorySourceFlags>(source))
117 {
118 if (m_IsImportEnabled && source == MemorySource::Malloc)
119 {
120 // Check memory alignment
121 if (!CanBeImported(memory, source))
122 {
123 if (m_Imported)
124 {
125 m_Imported = false;
126 m_UnmanagedMemory = nullptr;
127 }
128
129 return false;
130 }
131
132 // m_UnmanagedMemory not yet allocated.
133 if (!m_Imported && !m_UnmanagedMemory)
134 {
135 m_UnmanagedMemory = memory;
136 m_Imported = true;
137 return true;
138 }
139
140 // m_UnmanagedMemory initially allocated with Allocate().
141 if (!m_Imported && m_UnmanagedMemory)
142 {
143 return false;
144 }
145
146 // m_UnmanagedMemory previously imported.
147 if (m_Imported)
148 {
149 m_UnmanagedMemory = memory;
150 return true;
151 }
152 }
153 }
154
155 return false;
156}
157
158bool MockTensorHandle::CanBeImported(void* memory, MemorySource source)
159{

Callers 6

EnqueueInputMethod · 0.45
EnqueueOutputMethod · 0.45
LoadedNetwork.cppFile · 0.45
ImportOutputTensorMethod · 0.45
ImportInputsMethod · 0.45
ImportOutputsMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected