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 --- ...constants_float_to_half_tests_8cpp_source.xhtml | 140 +++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 21.02/_convert_constants_float_to_half_tests_8cpp_source.xhtml (limited to '21.02/_convert_constants_float_to_half_tests_8cpp_source.xhtml') diff --git a/21.02/_convert_constants_float_to_half_tests_8cpp_source.xhtml b/21.02/_convert_constants_float_to_half_tests_8cpp_source.xhtml new file mode 100644 index 0000000000..8c4fd1225a --- /dev/null +++ b/21.02/_convert_constants_float_to_half_tests_8cpp_source.xhtml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + +ArmNN: src/armnn/test/optimizations/ConvertConstantsFloatToHalfTests.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
ConvertConstantsFloatToHalfTests.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 "../TestUtils.hpp"
7 
8 #include <Optimizer.hpp>
9 #include <Half.hpp>
10 
11 #include <boost/test/unit_test.hpp>
12 
13 using namespace armnn;
14 
16 using namespace armnn::optimizations;
17 
18 BOOST_AUTO_TEST_CASE(ConvertConstantsFloatToHalfTest)
19 {
20  armnn::Graph graph;
21 
22  const armnn::TensorInfo info({ 1, 1, 1, 2 }, armnn::DataType::Float16);
23 
24  // Create const tensor from fp32 data
25  unsigned int dims[] = { 4, 1, 1, 1 };
26  std::vector<float> floatWeights{ 1.0f, 2.0f, 3.0f, 4.0f };
27  armnn::ConstTensor weights(armnn::TensorInfo(4, dims, armnn::DataType::Float32), floatWeights);
28 
29  // Create simple test network
30  auto input = graph.AddLayer<armnn::InputLayer>(0, "input");
32 
34  fc->m_Weight = std::make_unique<armnn::ScopedCpuTensorHandle>(weights);
35  fc->GetOutputSlot().SetTensorInfo(info);
36 
37  auto output = graph.AddLayer<armnn::OutputLayer>(1, "output");
38 
39  // Connect up the layers
40  input->GetOutputSlot().Connect(fc->GetInputSlot(0));
41  fc->GetOutputSlot().Connect(output->GetInputSlot(0));
42 
43  // Check tensor data type before conversion
44  BOOST_CHECK(fc->m_Weight->GetTensorInfo().GetDataType() == armnn::DataType::Float32);
45 
46  // Run the optimizer
48 
49  // Check tensor data type after conversion
50  BOOST_CHECK(fc->m_Weight->GetTensorInfo().GetDataType() == armnn::DataType::Float16);
51 
52  // Check whether data matches expected fp16 data
53  Half* data = fc->m_Weight->GetTensor<Half>();
54  BOOST_CHECK(data[0] == Half(1.0f));
55  BOOST_CHECK(data[1] == Half(2.0f));
56  BOOST_CHECK(data[2] == Half(3.0f));
57  BOOST_CHECK(data[3] == Half(4.0f));
58 }
59 
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
+
Optimizer::Optimizations MakeOptimizations(Args &&... args)
Definition: Optimizer.hpp:43
+
std::unique_ptr< ScopedCpuTensorHandle > m_Weight
A unique pointer to store Weight values.
+ + +
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
Definition: Graph.hpp:402
+
int Connect(InputSlot &destination)
Definition: Layer.cpp:83
+
static void Pass(Graph &graph, const Optimizations &optimizations)
Definition: Optimizer.cpp:16
+
Copyright (c) 2021 ARM Limited and Contributors.
+ +
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: OutputLayer.hpp:13
+
ConvertConstants< Float32ToFloat16, IsFloat16Layer > ConvertConstantsFloatToHalf
+
This layer represents a fully connected operation.
+
A FullyConnectedDescriptor for the FullyConnectedLayer.
+
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
Definition: Tensor.hpp:314
+ +
BOOST_AUTO_TEST_CASE(CheckConvolution2dLayer)
+ + +
BOOST_AUTO_TEST_SUITE_END()
+ +
A layer user-provided data can be bound to (e.g. inputs, outputs).
Definition: InputLayer.hpp:13
+
void SetTensorInfo(const TensorInfo &tensorInfo) override
Definition: Layer.cpp:58
+
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
Definition: Layer.hpp:318
+ +
half_float::half Half
Definition: Half.hpp:16
+ +
+
+ + + + -- cgit v1.2.1