12 #include <boost/test/unit_test.hpp> 27 input->GetOutputSlot(0).Connect(add->GetInputSlot(1));
28 add->GetOutputSlot(0).Connect(output->GetInputSlot(0));
32 input->GetOutputSlot(0).SetTensorInfo(info);
33 add->GetOutputSlot(0).SetTensorInfo(info);
41 std::ostringstream ss;
42 optimizedNet->SerializeToDot(ss);
44 auto inputId = input->GetGuid();
45 auto addId = add->GetGuid();
46 auto outputId = output->GetGuid();
48 std::stringstream expected;
50 "digraph Optimized {\n" 51 " node [shape=\"record\"];\n" 52 " edge [fontsize=8 fontcolor=\"blue\" fontname=\"arial-bold\"];\n" 53 " " << inputId <<
" [label=\"{Input|Guid : " << inputId <<
"\\lLayerType : Input\\l" 54 "BackendID : CpuRef\\l}\"];\n" 55 " " << addId <<
" [label=\"{Addition|Guid : " << addId <<
"\\lLayerType : Addition\\l" 56 "BackendID : CpuRef\\l}\"];\n" 57 " " << outputId <<
" [label=\"{Output|Guid : " << outputId <<
"\\lLayerType : Output\\l" 58 "BackendID : CpuRef\\l}\"];\n" 59 " " << inputId <<
" -> " << addId <<
" [label=< [4] >];\n" 60 " " << inputId <<
" -> " << addId <<
" [label=< [4] >];\n" 61 " " << addId <<
" -> " << outputId <<
" [label=< [4] >];\n" 64 BOOST_TEST(ss.str() == expected.str());
90 std::vector<std::string> errMessages;
95 BOOST_FAIL(
"Should have thrown an exception.");
101 BOOST_CHECK(errMessages.size() > 0);
128 BOOST_REQUIRE(optNet);
130 for (
auto&& layer : static_cast<armnn::OptimizedNetwork*>(optNet.get())->GetGraph())
135 #if defined(ARMCOMPUTENEON_ENABLED) 178 layer = net.AddActivationLayer(acDesc,
"ac");
184 layer = net.AddMultiplicationLayer(
"ml");
192 layer = net.AddSoftmaxLayer(softmaxDescriptor,
"sm");
198 layer = net.AddOutputLayer(0,
"ot");
206 std::vector<std::string> errMessages;
211 BOOST_FAIL(
"Should have thrown an exception.");
217 BOOST_CHECK(errMessages.size() > 0);
248 layer = net.AddActivationLayer(acDesc,
"ac");
254 layer = net.AddMultiplicationLayer(
"ml");
262 layer = net.AddSoftmaxLayer(softmaxDescriptor,
"sm");
268 layer = net.AddOutputLayer(0,
"ot");
282 for (
auto&& layer : static_cast<armnn::OptimizedNetwork*>(optNet.get())->GetGraph())
285 BOOST_CHECK_NO_THROW(
286 layer->CreateWorkload(fact));
317 BOOST_REQUIRE(optNet);
319 for (
auto&& layer : static_cast<armnn::OptimizedNetwork*>(optNet.get())->GetGraph())
326 #if defined(ARMCOMPUTENEON_ENABLED) 335 #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.
IConnectableLayer * AddOutputLayer(LayerBindingId id, const char *name=nullptr) override
Adds an output layer to the network.
CPU Execution: Reference C++ kernels.
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
IConnectableLayer * AddInputLayer(LayerBindingId id, const char *name=nullptr) override
Adds an input layer to the network.
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.
Private implementation of INetwork.
BOOST_AUTO_TEST_SUITE_END()
CPU Execution: NEON: ArmCompute.
IConnectableLayer * AddAdditionLayer(const char *name=nullptr) override
Adds an addition layer to the network.
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.
static INetworkPtr Create(NetworkOptions networkOptions={})
A SoftmaxDescriptor for the SoftmaxLayer.