ArmNN
 21.05
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 96 of file NetworkExecutionUtils.cpp.

100  : m_OutputBinding(binding)
101  , m_Scale(info.GetQuantizationScale())
102  , m_Offset(info.GetQuantizationOffset())
103  , m_OutputTensorFile(outputTensorFile)
104  , m_DequantizeOutput(dequantizeOutput) {}
int32_t GetQuantizationOffset() const
Definition: Tensor.cpp:469
float GetQuantizationScale() const
Definition: Tensor.cpp:452

Member Function Documentation

◆ operator()() [1/4]

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

Definition at line 106 of file NetworkExecutionUtils.cpp.

Referenced by operator()().

107 {
108  ForEachValue(values, [](float value)
109  {
110  printf("%f ", value);
111  });
112  WriteToFile(values);
113 }

◆ operator()() [2/4]

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

Definition at line 115 of file NetworkExecutionUtils.cpp.

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

116 {
117  if(m_DequantizeOutput)
118  {
119  auto& scale = m_Scale;
120  auto& offset = m_Offset;
121  std::vector<float> dequantizedValues;
122  ForEachValue(values, [&scale, &offset, &dequantizedValues](uint8_t value)
123  {
124  auto dequantizedValue = armnn::Dequantize(value, scale, offset);
125  printf("%f ", dequantizedValue);
126  dequantizedValues.push_back(dequantizedValue);
127  });
128  WriteToFile(dequantizedValues);
129  }
130  else
131  {
132  const std::vector<int> intValues(values.begin(), values.end());
133  operator()(intValues);
134  }
135 }
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 146 of file NetworkExecutionUtils.cpp.

References ARMNN_LOG.

147 {
148  ForEachValue(values, [](int value)
149  {
150  printf("%d ", value);
151  });
152  WriteToFile(values);
153 }

◆ operator()() [4/4]

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

Definition at line 137 of file NetworkExecutionUtils.cpp.

138 {
139  ForEachValue(values, [](int8_t value)
140  {
141  printf("%d ", value);
142  });
143  WriteToFile(values);
144 }

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