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/_quantization_input_8cpp_source.xhtml | 127 ++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 21.02/_quantization_input_8cpp_source.xhtml (limited to '21.02/_quantization_input_8cpp_source.xhtml') diff --git a/21.02/_quantization_input_8cpp_source.xhtml b/21.02/_quantization_input_8cpp_source.xhtml new file mode 100644 index 0000000000..65d0546a2f --- /dev/null +++ b/21.02/_quantization_input_8cpp_source.xhtml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + +ArmNN: src/armnnQuantizer/QuantizationInput.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  21.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
QuantizationInput.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 "QuantizationInput.hpp"
7 
8 #include <iostream>
9 #include <fstream>
10 #include <cstring>
11 #include "armnn/Exceptions.hpp"
12 
13 namespace armnnQuantizer
14 {
15 
16 QuantizationInput::QuantizationInput(const unsigned int passId,
17  const armnn::LayerBindingId bindingId,
18  const std::string fileName):
19  m_PassId(passId)
20 {
21  m_LayerBindingIdToFileName.emplace(bindingId, fileName);
22 }
23 
25 {
26  m_PassId = other.GetPassId();
27  m_LayerBindingIdToFileName.clear();
28  for (armnn::LayerBindingId bindingId : other.GetLayerBindingIds())
29  {
30  std::string filename = other.GetFileName(bindingId);
31  AddEntry(bindingId, filename);
32  }
33 }
34 
35 void QuantizationInput::AddEntry(const armnn::LayerBindingId bindingId, const std::string fileName)
36 {
37  m_LayerBindingIdToFileName.emplace(bindingId, fileName);
38 }
39 
40 std::vector<float> QuantizationInput::GetDataForEntry(const armnn::LayerBindingId bindingId) const
41 {
42  if (m_LayerBindingIdToFileName.at(bindingId).empty())
43  {
44  throw armnn::Exception("Layer binding ID not found");
45  }
46 
47  std::string fileName = m_LayerBindingIdToFileName.at(bindingId);
48  std::ifstream in(fileName.c_str(), std::ifstream::binary);
49  if (!in.is_open())
50  {
51  throw armnn::Exception("Failed to open input tensor file " + fileName);
52  }
53 
54  std::string line;
55  std::vector<float> values;
56  char* pEnd;
57 
58  while (std::getline(in, line, ' '))
59  {
60  values.emplace_back(std::strtof(line.c_str(), &pEnd));
61  }
62  return values;
63 }
64 
65 std::vector<armnn::LayerBindingId> QuantizationInput::GetLayerBindingIds() const
66 {
67  std::vector<armnn::LayerBindingId> layerBindingIDs;
68 
69  for (auto iterator = m_LayerBindingIdToFileName.begin(); iterator != m_LayerBindingIdToFileName.end(); ++iterator)
70  {
71  layerBindingIDs.emplace_back(iterator->first);
72  }
73  return layerBindingIDs;
74 }
75 
77 {
78  return m_LayerBindingIdToFileName.size();
79 }
80 
81 unsigned int QuantizationInput::GetPassId() const
82 {
83  return m_PassId;
84 }
85 
86 std::string QuantizationInput::GetFileName(const armnn::LayerBindingId bindingId) const
87 {
88  auto iterator = m_LayerBindingIdToFileName.find(bindingId);
89  if (iterator != m_LayerBindingIdToFileName.end())
90  {
91  return m_LayerBindingIdToFileName.at(bindingId);
92  }
93  else
94  {
95  throw armnn::Exception("Could not retrieve filename for binding ID " + std::to_string(bindingId));
96  }
97 }
98 
100 {
101 }
102 
103 }
QuantizationInput(const unsigned int passId, const armnn::LayerBindingId bindingId, const std::string fileName)
Constructor for QuantizationInput.
+
void AddEntry(const armnn::LayerBindingId bindingId, const std::string fileName)
+
QuantizationInput for specific pass ID, can list a corresponding raw data file for each LayerBindingI...
+
~QuantizationInput() noexcept
Destructor.
+
std::vector< float > GetDataForEntry(const armnn::LayerBindingId bindingId) const
+
int LayerBindingId
Type of identifiers for bindable layers (inputs, outputs).
Definition: Types.hpp:210
+
std::vector< armnn::LayerBindingId > GetLayerBindingIds() const
Retrieve Layer Binding IDs for this QuantizationInput.
+ +
unsigned long GetNumberOfInputs() const
Get number of inputs for this QuantizationInput.
+ +
std::string GetFileName(const armnn::LayerBindingId bindingId) const
Retrieve filename path for specified Layer Binding ID.
+
Base class for all ArmNN exceptions so that users can filter to just those.
Definition: Exceptions.hpp:46
+ +
unsigned int GetPassId() const
Retrieve Pass ID for this QuantizationInput.
+
+
+ + + + -- cgit v1.2.1