From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ...se_unary_end_to_end_test_impl_8hpp_source.xhtml | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 20.02/_elementwise_unary_end_to_end_test_impl_8hpp_source.xhtml (limited to '20.02/_elementwise_unary_end_to_end_test_impl_8hpp_source.xhtml') diff --git a/20.02/_elementwise_unary_end_to_end_test_impl_8hpp_source.xhtml b/20.02/_elementwise_unary_end_to_end_test_impl_8hpp_source.xhtml new file mode 100644 index 0000000000..e457104f08 --- /dev/null +++ b/20.02/_elementwise_unary_end_to_end_test_impl_8hpp_source.xhtml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + +ArmNN: src/backends/backendsCommon/test/ElementwiseUnaryEndToEndTestImpl.hpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ElementwiseUnaryEndToEndTestImpl.hpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 #pragma once
6 
7 #include "CommonTestUtils.hpp"
8 
9 #include <ResolveType.hpp>
10 
11 #include <armnn/INetwork.hpp>
12 
13 #include <boost/test/unit_test.hpp>
14 
15 #include <vector>
16 
17 namespace
18 {
19 
20 template<armnn::DataType ArmnnTypeInput>
21 INetworkPtr CreateElementwiseUnaryNetwork(const TensorShape& inputShape,
22  const TensorShape& outputShape,
23  UnaryOperation operation,
24  const float qScale = 1.0f,
25  const int32_t qOffset = 0)
26 {
27  using namespace armnn;
28 
30 
31  ElementwiseUnaryDescriptor descriptor(operation);
32  IConnectableLayer* elementwiseUnaryLayer = net->AddElementwiseUnaryLayer(descriptor, "elementwiseUnary");
33 
34  TensorInfo inputTensorInfo(inputShape, ArmnnTypeInput, qScale, qOffset);
35  IConnectableLayer* input = net->AddInputLayer(boost::numeric_cast<LayerBindingId>(0));
36  Connect(input, elementwiseUnaryLayer, inputTensorInfo, 0, 0);
37 
38  TensorInfo outputTensorInfo(outputShape, ArmnnTypeInput, qScale, qOffset);
39  IConnectableLayer* output = net->AddOutputLayer(0, "output");
40  Connect(elementwiseUnaryLayer, output, outputTensorInfo, 0, 0);
41 
42  return net;
43 }
44 
45 template<armnn::DataType ArmnnInType,
46  typename TInput = armnn::ResolveType<ArmnnInType>>
47 void ElementwiseUnarySimpleEndToEnd(const std::vector<BackendId>& backends,
48  UnaryOperation operation,
49  const std::vector<float> expectedOutput)
50 {
51  using namespace armnn;
52 
53  const float qScale = IsQuantizedType<TInput>() ? 0.25f : 1.0f;
54  const int32_t qOffset = IsQuantizedType<TInput>() ? 50 : 0;
55 
56  const TensorShape& inputShape = { 2, 2, 2, 2 };
57  const TensorShape& outputShape = { 2, 2, 2, 2 };
58 
59  // Builds up the structure of the network
60  INetworkPtr net = CreateElementwiseUnaryNetwork<ArmnnInType>(inputShape, outputShape, operation, qScale, qOffset);
61 
62  BOOST_TEST_CHECKPOINT("create a network");
63 
64  const std::vector<float> input({ 1, -1, 1, 1, 5, -5, 5, 5,
65  -3, 3, 3, 3, 4, 4, -4, 4 });
66 
67  // quantize data
68  std::vector<TInput> qInputData = armnnUtils::QuantizedVector<TInput>(input, qScale, qOffset);
69  std::vector<TInput> qExpectedOutput = armnnUtils::QuantizedVector<TInput>(expectedOutput, qScale, qOffset);
70 
71  std::map<int, std::vector<TInput>> inputTensorData = {{ 0, qInputData }};
72  std::map<int, std::vector<TInput>> expectedOutputData = {{ 0, qExpectedOutput }};
73 
74  EndToEndLayerTestImpl<ArmnnInType, ArmnnInType>(move(net), inputTensorData, expectedOutputData, backends);
75 }
76 
77 } // anonymous namespace
Interface for a layer that is connectable to other layers via InputSlots and OutputSlots.
Definition: INetwork.hpp:61
+ +
typename ResolveTypeImpl< DT >::Type ResolveType
Definition: ResolveType.hpp:73
+ +
Copyright (c) 2020 ARM Limited.
+ + +
DataType
Definition: Types.hpp:32
+ +
A ElementwiseUnaryDescriptor for the ElementwiseUnaryLayer.
Definition: Descriptors.hpp:82
+
UnaryOperation
Definition: Types.hpp:87
+
void Connect(armnn::IConnectableLayer *from, armnn::IConnectableLayer *to, const armnn::TensorInfo &tensorInfo, unsigned int fromIndex, unsigned int toIndex)
Definition: TestUtils.cpp:12
+
std::unique_ptr< INetwork, void(*)(INetwork *network)> INetworkPtr
Definition: INetwork.hpp:101
+
static INetworkPtr Create()
Definition: Network.cpp:49
+
+
+ + + + -- cgit v1.2.1