From fd627ffaec8fd8801d980b4c91ee7c0607ab6aaf Mon Sep 17 00:00:00 2001 From: Jan Eilers Date: Thu, 25 Feb 2021 17:44:00 +0000 Subject: IVGCVSW-5687 Update Doxygen Docu * Update Doxygen Documentation for 21.02 release Signed-off-by: Jan Eilers Change-Id: I9ed2f9caab038836ea99d7b378d7899fe431a4e5 --- 21.02/_debug_callback_test_8cpp_source.xhtml | 150 +++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 21.02/_debug_callback_test_8cpp_source.xhtml (limited to '21.02/_debug_callback_test_8cpp_source.xhtml') diff --git a/21.02/_debug_callback_test_8cpp_source.xhtml b/21.02/_debug_callback_test_8cpp_source.xhtml new file mode 100644 index 0000000000..3f56575a6e --- /dev/null +++ b/21.02/_debug_callback_test_8cpp_source.xhtml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/DebugCallbackTest.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
DebugCallbackTest.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include <armnn/Descriptors.hpp>
7 #include <armnn/IRuntime.hpp>
8 #include <armnn/INetwork.hpp>
9 #include <armnn/Types.hpp>
10 #include <Runtime.hpp>
11 
12 #include <boost/test/unit_test.hpp>
13 
14 BOOST_AUTO_TEST_SUITE(DebugCallback)
15 
16 namespace
17 {
18 
19 using namespace armnn;
20 
21 INetworkPtr CreateSimpleNetwork()
22 {
24 
25  IConnectableLayer* input = net->AddInputLayer(0, "Input");
26 
27  ActivationDescriptor descriptor;
29  IConnectableLayer* activationLayer = net->AddActivationLayer(descriptor, "Activation:ReLu");
30 
31  IConnectableLayer* output = net->AddOutputLayer(0);
32 
33  input->GetOutputSlot(0).Connect(activationLayer->GetInputSlot(0));
34  activationLayer->GetOutputSlot(0).Connect(output->GetInputSlot(0));
35 
36  input->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 1, 5 }, DataType::Float32));
37  activationLayer->GetOutputSlot(0).SetTensorInfo(TensorInfo({ 1, 1, 1, 5 }, DataType::Float32));
38 
39  return net;
40 }
41 
42 BOOST_AUTO_TEST_CASE(RuntimeRegisterDebugCallback)
43 {
44  INetworkPtr net = CreateSimpleNetwork();
45 
47  IRuntimePtr runtime(IRuntime::Create(options));
48 
49  // Optimize the network with debug option
50  OptimizerOptions optimizerOptions(false, true);
51  std::vector<BackendId> backends = { "CpuRef" };
52  IOptimizedNetworkPtr optNet = Optimize(*net, backends, runtime->GetDeviceSpec(), optimizerOptions);
53 
54  NetworkId netId;
55  BOOST_TEST(runtime->LoadNetwork(netId, std::move(optNet)) == Status::Success);
56 
57  // Set up callback function
58  int callCount = 0;
59  std::vector<TensorShape> tensorShapes;
60  std::vector<unsigned int> slotIndexes;
61  auto mockCallback = [&](LayerGuid guid, unsigned int slotIndex, ITensorHandle* tensor)
62  {
63  IgnoreUnused(guid);
64  slotIndexes.push_back(slotIndex);
65  tensorShapes.push_back(tensor->GetShape());
66  callCount++;
67  };
68 
69  runtime->RegisterDebugCallback(netId, mockCallback);
70 
71  std::vector<float> inputData({-2, -1, 0, 1, 2});
72  std::vector<float> outputData(5);
73 
74  InputTensors inputTensors
75  {
76  {0, ConstTensor(runtime->GetInputTensorInfo(netId, 0), inputData.data())}
77  };
78  OutputTensors outputTensors
79  {
80  {0, Tensor(runtime->GetOutputTensorInfo(netId, 0), outputData.data())}
81  };
82 
83  runtime->EnqueueWorkload(netId, inputTensors, outputTensors);
84 
85  // Check that the callback was called twice
86  BOOST_TEST(callCount == 2);
87 
88  // Check that tensor handles passed to callback have correct shapes
89  const std::vector<TensorShape> expectedShapes({TensorShape({1, 1, 1, 5}), TensorShape({1, 1, 1, 5})});
90  BOOST_TEST(tensorShapes == expectedShapes);
91 
92  // Check that slot indexes passed to callback are correct
93  const std::vector<unsigned int> expectedSlotIndexes({0, 0});
94  BOOST_TEST(slotIndexes == expectedSlotIndexes);
95 }
96 
97 } // anonymous namespace
98 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
+ +
static IRuntimePtr Create(const CreationOptions &options)
Definition: Runtime.cpp:37
+
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:62
+ + + +
std::unique_ptr< IRuntime, void(*)(IRuntime *runtime)> IRuntimePtr
Definition: IRuntime.hpp:26
+ +
std::vector< std::pair< LayerBindingId, class ConstTensor > > InputTensors
Definition: Tensor.hpp:340
+
int NetworkId
Definition: IRuntime.hpp:20
+
Copyright (c) 2021 ARM Limited and Contributors.
+
void IgnoreUnused(Ts &&...)
+ +
virtual void SetTensorInfo(const TensorInfo &tensorInfo)=0
+
A tensor defined by a TensorInfo (shape and data type) and a mutable backing store.
Definition: Tensor.hpp:306
+ +
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.
Definition: Network.cpp:1502
+ + +
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:314
+
std::vector< std::pair< LayerBindingId, class Tensor > > OutputTensors
Definition: Tensor.hpp:341
+
std::unique_ptr< IOptimizedNetwork, void(*)(IOptimizedNetwork *network)> IOptimizedNetworkPtr
Definition: INetwork.hpp:174
+
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
+ +
An ActivationDescriptor for the ActivationLayer.
Definition: Descriptors.hpp:25
+ + +
BOOST_AUTO_TEST_SUITE_END()
+ +
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
Definition: INetwork.hpp:173
+
virtual int Connect(IInputSlot &destination)=0
+
static INetworkPtr Create(NetworkOptions networkOptions={})
Definition: Network.cpp:510
+
ActivationFunction m_Function
The activation function to use (Sigmoid, TanH, Linear, ReLu, BoundedReLu, SoftReLu, LeakyReLu, Abs, Sqrt, Square, Elu).
Definition: Descriptors.hpp:48
+
+
+ + + + -- cgit v1.2.1