13 #include <doctest/doctest.h> 21 SwapRegistryStorage() :
armnn::BackendRegistry()
26 ~SwapRegistryStorage()
32 FactoryStorage m_TempStorage;
39 TEST_CASE(
"SwapRegistry")
41 using namespace armnn;
44 SwapRegistryStorage helper;
50 TEST_CASE(
"TestRegistryHelper")
52 using namespace armnn;
53 SwapRegistryStorage helper;
68 CHECK(called ==
false);
73 CHECK(called ==
false);
76 CHECK(called ==
true);
80 TEST_CASE(
"TestDirectCallToRegistry")
82 using namespace armnn;
83 SwapRegistryStorage helper;
96 CHECK(called ==
false);
101 CHECK(called ==
false);
104 CHECK(called ==
true);
115 TEST_CASE(
"ThrowBackendUnavailableException")
117 using namespace armnn;
119 const BackendId mockBackendId(
"MockDynamicBackend");
121 const std::string exceptionMessage(
"Mock error message to test unavailable backend");
137 auto backend = factoryFunc();
138 FAIL(
"Expected exception to have been thrown");
143 CHECK_EQ(e.
what(), exceptionMessage);
149 #if defined(ARMNNREF_ENABLED) 150 TEST_CASE(
"RegisterMemoryOptimizerStrategy")
152 using namespace armnn;
158 std::shared_ptr<IMemoryOptimizerStrategy> memoryOptimizerStrategy =
159 std::make_shared<ConstantMemoryStrategy>();
TEST_SUITE("TestConstTensorLayerVisitor")
FactoryFunction GetFactory(const BackendId &id) const
CPU Execution: Reference C++ kernels.
void Register(const BackendId &id, FactoryFunction factory)
static void Swap(BackendRegistry &instance, FactoryStorage &other)
For testing only.
void RegisterMemoryOptimizerStrategy(const BackendId &id, std::shared_ptr< IMemoryOptimizerStrategy > strategy)
virtual const char * what() const noexcept override
BackendRegistry & BackendRegistryInstance()
Copyright (c) 2021 ARM Limited and Contributors.
void DeregisterMemoryOptimizerStrategy(const BackendId &id)
void Deregister(const BackendId &id)
std::unique_ptr< IBackendInternal > IBackendInternalUniquePtr
Class for non-fatal exceptions raised while initialising a backend.