Go to the source code of this file.
◆ BOOST_AUTO_TEST_CASE() [1/10]
BOOST_AUTO_TEST_CASE |
( |
AcquireAndRelease |
| ) |
|
Definition at line 13 of file RefTensorHandleTests.cpp.
References armnn::Float32, and armnn::info.
15 std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
23 memoryManager->Acquire();
25 float* buffer =
reinterpret_cast<float*
>(handle.Map());
27 BOOST_CHECK(buffer !=
nullptr);
31 BOOST_CHECK(buffer[0] == 2.5f);
34 memoryManager->Release();
36 memoryManager->Acquire();
38 float* buffer =
reinterpret_cast<float*
>(handle.Map());
40 BOOST_CHECK(buffer !=
nullptr);
44 BOOST_CHECK(buffer[0] == 3.5f);
46 memoryManager->Release();
◆ BOOST_AUTO_TEST_CASE() [2/10]
BOOST_AUTO_TEST_CASE |
( |
RefTensorHandleFactoryMemoryManaged |
| ) |
|
Definition at line 49 of file RefTensorHandleTests.cpp.
References armnn::Float32, armnn::info, and armnn::Malloc.
51 std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
56 auto handle = handleFactory.CreateTensorHandle(info,
true);
60 memoryManager->Acquire();
62 float* buffer =
reinterpret_cast<float*
>(handle->Map());
63 BOOST_CHECK(buffer !=
nullptr);
66 BOOST_CHECK(buffer[0] == 1.5f);
67 BOOST_CHECK(buffer[1] == 2.5f);
69 memoryManager->Release();
71 memoryManager->Acquire();
73 float* buffer =
reinterpret_cast<float*
>(handle->Map());
74 BOOST_CHECK(buffer !=
nullptr);
77 BOOST_CHECK(buffer[0] == 3.5f);
78 BOOST_CHECK(buffer[1] == 4.5f);
80 memoryManager->Release();
82 float testPtr[2] = { 2.5f, 5.5f };
84 BOOST_CHECK(!handle->Import(static_cast<void*>(testPtr), MemorySource::Malloc));
◆ BOOST_AUTO_TEST_CASE() [3/10]
BOOST_AUTO_TEST_CASE |
( |
RefTensorHandleFactoryImport |
| ) |
|
Definition at line 87 of file RefTensorHandleTests.cpp.
References armnn::Float32, armnn::info, and armnn::Malloc.
89 std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
94 auto handle = handleFactory.CreateTensorHandle(info,
false);
97 memoryManager->Acquire();
102 float testPtr[2] = { 2.5f, 5.5f };
104 BOOST_CHECK(handle->Import(static_cast<void*>(testPtr), MemorySource::Malloc));
105 float* buffer =
reinterpret_cast<float*
>(handle->Map());
106 BOOST_CHECK(buffer !=
nullptr);
107 BOOST_CHECK(buffer == testPtr);
109 BOOST_CHECK(buffer[0] == 2.5f);
110 BOOST_CHECK(buffer[1] == 5.5f);
113 BOOST_CHECK(buffer[0] == 3.5f);
114 BOOST_CHECK(buffer[1] == 10.0f);
115 memoryManager->Release();
◆ BOOST_AUTO_TEST_CASE() [4/10]
BOOST_AUTO_TEST_CASE |
( |
RefTensorHandleImport |
| ) |
|
Definition at line 118 of file RefTensorHandleTests.cpp.
References armnn::Float32, armnn::info, and armnn::Malloc.
121 RefTensorHandle handle(info, static_cast<unsigned int>(MemorySource::Malloc));
129 float testPtr[2] = { 2.5f, 5.5f };
131 BOOST_CHECK(handle.Import(static_cast<void*>(testPtr), MemorySource::Malloc));
132 float* buffer =
reinterpret_cast<float*
>(handle.Map());
133 BOOST_CHECK(buffer !=
nullptr);
134 BOOST_CHECK(buffer == testPtr);
136 BOOST_CHECK(buffer[0] == 2.5f);
137 BOOST_CHECK(buffer[1] == 5.5f);
140 BOOST_CHECK(buffer[0] == 3.5f);
141 BOOST_CHECK(buffer[1] == 10.0f);
◆ BOOST_AUTO_TEST_CASE() [5/10]
BOOST_AUTO_TEST_CASE |
( |
RefTensorHandleGetCapabilities |
| ) |
|
Definition at line 144 of file RefTensorHandleTests.cpp.
References IOutputSlot::Connect(), INetwork::Create(), IConnectableLayer::GetInputSlot(), IConnectableLayer::GetOutputSlot(), and armnn::PaddingRequired.
146 std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
155 std::vector<Capability> capabilities = handleFactory.GetCapabilities(input,
157 CapabilityClass::PaddingRequired);
158 BOOST_CHECK(capabilities.empty());
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
virtual const IInputSlot & GetInputSlot(unsigned int index) const =0
Get a const input slot handle by slot index.
virtual const IOutputSlot & GetOutputSlot(unsigned int index) const =0
Get the const output slot handle by slot index.
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
virtual int Connect(IInputSlot &destination)=0
◆ BOOST_AUTO_TEST_CASE() [6/10]
BOOST_AUTO_TEST_CASE |
( |
RefTensorHandleSupportsInPlaceComputation |
| ) |
|
Definition at line 161 of file RefTensorHandleTests.cpp.
References ARMNN_ASSERT.
163 std::shared_ptr<RefMemoryManager> memoryManager = std::make_shared<RefMemoryManager>();
167 ARMNN_ASSERT(!(handleFactory.SupportsInPlaceComputation()));
#define ARMNN_ASSERT(COND)
◆ BOOST_AUTO_TEST_CASE() [7/10]
BOOST_AUTO_TEST_CASE |
( |
TestManagedConstTensorHandle |
| ) |
|
Definition at line 170 of file RefTensorHandleTests.cpp.
References armnn::info.
177 auto passThroughHandle = std::make_shared<PassthroughTensorHandle>(info, mem);
181 BOOST_CHECK(!managedHandle.IsMapped());
183 BOOST_CHECK(managedHandle.IsMapped());
186 managedHandle.Unmap();
187 BOOST_CHECK(!managedHandle.IsMapped());
190 BOOST_CHECK(managedHandle.GetTensorInfo() == info);
194 BOOST_CHECK(!managedHandleNull.IsMapped());
196 BOOST_CHECK(!managedHandleNull.IsMapped());
199 managedHandleNull.Unmap();
200 BOOST_CHECK(!managedHandleNull.IsMapped());
Base class for all ArmNN exceptions so that users can filter to just those.
◆ BOOST_AUTO_TEST_CASE() [8/10]
BOOST_AUTO_TEST_CASE |
( |
CheckSourceType |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [9/10]
BOOST_AUTO_TEST_CASE |
( |
ReusePointer |
| ) |
|
◆ BOOST_AUTO_TEST_CASE() [10/10]
BOOST_AUTO_TEST_CASE |
( |
MisalignedPointer |
| ) |
|