From de36e4a9c299028e792c3a5bd99ad0816d806077 Mon Sep 17 00:00:00 2001 From: Ryan OShea Date: Fri, 13 Mar 2020 16:26:19 +0000 Subject: IVGCVSW-3726 Upload ArmNN Doxygen files * Upload current ArmNN Doxygen files Signed-off-by: Ryan OShea Change-Id: I8989ed16ee40a99a4495b100bd009cf3e24a7285 --- ...g_softmax_end_to_end_test_impl_8cpp_source.html | 118 +++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 Documentation/_log_softmax_end_to_end_test_impl_8cpp_source.html (limited to 'Documentation/_log_softmax_end_to_end_test_impl_8cpp_source.html') diff --git a/Documentation/_log_softmax_end_to_end_test_impl_8cpp_source.html b/Documentation/_log_softmax_end_to_end_test_impl_8cpp_source.html new file mode 100644 index 0000000000..9cd4f5777a --- /dev/null +++ b/Documentation/_log_softmax_end_to_end_test_impl_8cpp_source.html @@ -0,0 +1,118 @@ + + + + + + + +ArmNN: src/backends/backendsCommon/test/LogSoftmaxEndToEndTestImpl.cpp Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
ArmNN +  NotReleased +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
LogSoftmaxEndToEndTestImpl.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "EndToEndTestImpl.hpp"
8 
9 #include <armnn/INetwork.hpp>
10 
11 #include <test/TestUtils.hpp>
12 
13 #include <boost/test/unit_test.hpp>
14 
15 namespace {
16 
17 template <typename armnn::DataType DataType>
18 armnn::INetworkPtr CreateLogSoftmaxNetwork(const armnn::TensorShape& inputShape,
19  const armnn::TensorShape& outputShape,
20  const float beta,
21  const int axis,
22  const float qScale = 1.0f,
23  const int32_t qOffset = 0)
24 {
25  using namespace armnn;
26 
27  // Builds up the structure of the network.
29 
30  TensorInfo inputTensorInfo(inputShape, DataType, qScale, qOffset);
31 
32  LogSoftmaxDescriptor logSoftmaxDesc;
33  logSoftmaxDesc.m_Beta = beta;
34  logSoftmaxDesc.m_Axis = axis;
35 
36  IConnectableLayer* logSoftmax = net->AddLogSoftmaxLayer(logSoftmaxDesc, "Log_Softmax");
37  IConnectableLayer* input = net->AddInputLayer(0, "input");
38  Connect(input, logSoftmax, inputTensorInfo, 0, 0);
39 
40  TensorInfo outputTensorInfo(outputShape, DataType, qScale, qOffset);
41  IConnectableLayer* output = net->AddOutputLayer(0, "output");
42  Connect(logSoftmax, output, outputTensorInfo, 0, 0);
43 
44  return net;
45 }
46 
47 void LogSoftmaxEndToEnd(const std::vector<armnn::BackendId>& backends,
48  armnn::TensorInfo& inputTensorInfo,
49  armnn::TensorInfo& outputTensorInfo,
50  std::vector<float>& inputData,
51  std::vector<float>& expectedOutputData,
52  const float beta,
53  const int axis)
54 {
55  using namespace armnn;
56 
57  // Builds up the structure of the network
58  INetworkPtr net = CreateLogSoftmaxNetwork<DataType::Float32>(inputTensorInfo.GetShape(),
59  outputTensorInfo.GetShape(),
60  beta,
61  axis);
62 
63  BOOST_TEST_CHECKPOINT("Create a network");
64 
65  std::map<int, std::vector<float>> inputTensorData = { {0, inputData} };
66  std::map<int, std::vector<float>> expectedOutputTensorData = { {0, expectedOutputData} };
67 
68  EndToEndLayerTestImpl<DataType::Float32, DataType::Float32>(move(net),
69  inputTensorData,
70  expectedOutputTensorData,
71  backends);
72 }
73 
74 } // anonymous namespace
75 
76 void LogSoftmaxEndToEndTest(const std::vector<armnn::BackendId>& defaultBackends)
77 {
78  using namespace armnn;
79 
80  const float beta = 10.0f; // non-default beta
81  const int axis = 3; // positive axis
82 
83  const TensorShape inputShape{1, 1, 2, 4};
84  TensorInfo inputTensorInfo(inputShape, DataType::Float32);
85 
86  const TensorShape outputShape{1, 1, 2, 4};
87  TensorInfo outputTensorInfo(outputShape, DataType::Float32);
88 
89  std::vector<float> inputData = std::vector<float>({
90  0.0f, -0.6f, 0.2f, 0.4f,
91  0.3f, -0.2f, 1.0f, 0.1f
92  });
93 
94  std::vector<float> expectedOutputData = std::vector<float>({
95  -4.14297f, -10.14297f, -2.14297f, -0.14297f,
96  -7.00104f, -12.00104f, -0.00104087f, -9.00104f
97  });
98 
99  LogSoftmaxEndToEnd(defaultBackends,
100  inputTensorInfo,
101  outputTensorInfo,
102  inputData,
103  expectedOutputData,
104  beta,
105  axis);
106 }
+ +
void LogSoftmaxEndToEndTest(const std::vector< armnn::BackendId > &defaultBackends)
+ +
float m_Beta
Exponentiation value.
+
static INetworkPtr Create()
Definition: Network.cpp:48
+ +
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:85
+
A SoftmaxDescriptor for the SoftmaxLayer.
+
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
Definition: TestUtils.cpp:12
+
DataType
Definition: Types.hpp:32
+ +
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
+ + +
int m_Axis
Scalar, defaulted to the last index (-1), specifying the dimension the activation will be performed o...
+
const TensorShape & GetShape() const
Definition: Tensor.hpp:88
+
std::vector< armnn::BackendId > defaultBackends
+ +
+
+ + + + -- cgit v1.2.1