ArmNN
 21.08
TensorPrinter Struct Reference

#include <NetworkExecutionUtils.hpp>

Public Member Functions

 TensorPrinter (const std::string &binding, const armnn::TensorInfo &info, const std::string &outputTensorFile, bool dequantizeOutput)
 
void operator() (const std::vector< float > &values)
 
void operator() (const std::vector< uint8_t > &values)
 
void operator() (const std::vector< int > &values)
 
void operator() (const std::vector< int8_t > &values)
 

Detailed Description

Definition at line 24 of file NetworkExecutionUtils.hpp.

Constructor & Destructor Documentation

◆ TensorPrinter()

TensorPrinter ( const std::string &  binding,
const armnn::TensorInfo info,
const std::string &  outputTensorFile,
bool  dequantizeOutput 
)

Definition at line 116 of file NetworkExecutionUtils.cpp.

120  : m_OutputBinding(binding)
121  , m_Scale(info.GetQuantizationScale())
122  , m_Offset(info.GetQuantizationOffset())
123  , m_OutputTensorFile(outputTensorFile)
124  , m_DequantizeOutput(dequantizeOutput) {}
int32_t GetQuantizationOffset() const
Definition: Tensor.cpp:480
float GetQuantizationScale() const
Definition: Tensor.cpp:463

Member Function Documentation

◆ operator()() [1/4]

void operator() ( const std::vector< float > &  values)

Definition at line 126 of file NetworkExecutionUtils.cpp.

Referenced by operator()().

127 {
128  ForEachValue(values, [](float value)
129  {
130  printf("%f ", value);
131  });
132  WriteToFile(values);
133 }

◆ operator()() [2/4]

void operator() ( const std::vector< uint8_t > &  values)

Definition at line 135 of file NetworkExecutionUtils.cpp.

References armnn::Dequantize(), and operator()().

136 {
137  if(m_DequantizeOutput)
138  {
139  auto& scale = m_Scale;
140  auto& offset = m_Offset;
141  std::vector<float> dequantizedValues;
142  ForEachValue(values, [&scale, &offset, &dequantizedValues](uint8_t value)
143  {
144  auto dequantizedValue = armnn::Dequantize(value, scale, offset);
145  printf("%f ", dequantizedValue);
146  dequantizedValues.push_back(dequantizedValue);
147  });
148  WriteToFile(dequantizedValues);
149  }
150  else
151  {
152  const std::vector<int> intValues(values.begin(), values.end());
153  operator()(intValues);
154  }
155 }
float Dequantize(QuantizedType value, float scale, int32_t offset)
Dequantize an 8-bit data type into a floating point data type.
Definition: TypesUtils.cpp:46
void operator()(const std::vector< float > &values)

◆ operator()() [3/4]

void operator() ( const std::vector< int > &  values)

Definition at line 166 of file NetworkExecutionUtils.cpp.

References ARMNN_LOG.

167 {
168  ForEachValue(values, [](int value)
169  {
170  printf("%d ", value);
171  });
172  WriteToFile(values);
173 }

◆ operator()() [4/4]

void operator() ( const std::vector< int8_t > &  values)

Definition at line 157 of file NetworkExecutionUtils.cpp.

158 {
159  ForEachValue(values, [](int8_t value)
160  {
161  printf("%d ", value);
162  });
163  WriteToFile(values);
164 }

The documentation for this struct was generated from the following files: