12 #include <boost/test/unit_test.hpp> 22 auto input = net->AddInputLayer(0);
23 auto add = net->AddAdditionLayer();
24 auto output = net->AddOutputLayer(0);
27 input->GetOutputSlot(0).Connect(add->GetInputSlot(0));
28 input->GetOutputSlot(0).Connect(add->GetInputSlot(1));
29 add->GetOutputSlot(0).Connect(output->GetInputSlot(0));
33 input->GetOutputSlot(0).SetTensorInfo(info);
34 add->GetOutputSlot(0).SetTensorInfo(info);
42 std::ostringstream ss;
43 optimizedNet->SerializeToDot(ss);
45 auto inputId = input->GetGuid();
46 auto addId = add->GetGuid();
47 auto outputId = output->GetGuid();
49 std::stringstream expected;
51 "digraph Optimized {\n" 52 " node [shape=\"record\"];\n" 53 " edge [fontsize=8 fontcolor=\"blue\" fontname=\"arial-bold\"];\n" 54 " " << inputId <<
" [label=\"{Input|Guid : " << inputId <<
"\\lLayerType : Input\\l" 55 "BackendID : CpuRef\\l}\"];\n" 56 " " << addId <<
" [label=\"{Addition|Guid : " << addId <<
"\\lLayerType : Addition\\l" 57 "BackendID : CpuRef\\l}\"];\n" 58 " " << outputId <<
" [label=\"{Output|Guid : " << outputId <<
"\\lLayerType : Output\\l" 59 "BackendID : CpuRef\\l}\"];\n" 60 " " << inputId <<
" -> " << addId <<
" [label=< [4] >];\n" 61 " " << inputId <<
" -> " << addId <<
" [label=< [4] >];\n" 62 " " << addId <<
" -> " << outputId <<
" [label=< [4] >];\n" 65 BOOST_TEST(ss.str() == expected.str());
91 std::vector<std::string> errMessages;
96 BOOST_FAIL(
"Should have thrown an exception.");
102 BOOST_CHECK(errMessages.size() > 0);
129 BOOST_REQUIRE(optNet);
134 for (
auto&& layer : graph)
139 #if defined(ARMCOMPUTENEON_ENABLED) 183 layer = net->AddActivationLayer(acDesc,
"ac");
189 layer = net->AddMultiplicationLayer(
"ml");
197 layer = net->AddSoftmaxLayer(softmaxDescriptor,
"sm");
203 layer = net->AddOutputLayer(0,
"ot");
211 std::vector<std::string> errMessages;
216 BOOST_FAIL(
"Should have thrown an exception.");
222 BOOST_CHECK(errMessages.size() > 0);
254 layer = net->AddActivationLayer(acDesc,
"ac");
260 layer = net->AddMultiplicationLayer(
"ml");
268 layer = net->AddSoftmaxLayer(softmaxDescriptor,
"sm");
274 layer = net->AddOutputLayer(0,
"ot");
291 for (
auto&& layer : graph)
294 BOOST_CHECK_NO_THROW(
295 layer->CreateWorkload(fact));
326 BOOST_REQUIRE(optNet);
331 for (
auto&& layer : graph)
338 #if defined(ARMCOMPUTENEON_ENABLED) 347 #elif defined(ARMCOMPUTECL_ENABLED) BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
static IRuntimePtr Create(const CreationOptions &options)
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
IOptimizedNetworkPtr Optimize(const INetwork &network, const std::vector< BackendId > &backendPreferences, const IDeviceSpec &deviceSpec, const OptimizerOptions &options=OptimizerOptions(), Optional< std::vector< std::string > &> messages=EmptyOptional())
Create an optimized version of the network.
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
GPU Execution: OpenCL: ArmCompute.
An ActivationDescriptor for the ActivationLayer.
Graph & GetGraphForTesting(IOptimizedNetwork *optNet)
BOOST_AUTO_TEST_SUITE_END()
CPU Execution: NEON: ArmCompute.
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(SerializeToDot)
A NormalizationDescriptor for the NormalizationLayer.
Status AllocateDynamicBuffers()
Allocates memory for all tensors under output tensor handers of each layer.
static INetworkPtr Create(NetworkOptions networkOptions={})
A SoftmaxDescriptor for the SoftmaxLayer.