ONE - On-device Neural Engine
|
Functions | |
Tensor | makeOutputTensor (DataType element_type) |
Tensor | makeOutputTensor (DataType element_type, float scale, int32_t zero_point) |
std::vector< float > | dequantizeTensorData (const Tensor &tensor) |
Matcher< std::vector< float > > | FloatArrayNear (const std::vector< float > &values, float max_abs_error) |
std::vector< int32_t > | extractTensorShape (const Tensor &tensor) |
template<typename T > | |
std::vector< T > | quantize (const float *data, size_t num_elements, float scale, int32_t zero_point) |
template<DataType DT> | |
Tensor | makeInputTensor (const Shape &shape, const std::vector< typename DataTypeImpl< DT >::Type > &data, IMemoryManager *memory_manager) |
template<DataType DT> | |
Tensor | makeInputTensor (const Shape &shape, float scale, int32_t zero_point, const std::vector< float > &data, IMemoryManager *memory_manager) |
Create layer-wise quantized tensor. | |
template<DataType DT> | |
Tensor | makeInputTensor (const Shape &shape, const std::vector< float > &scales, const std::vector< int32_t > &zero_points, int quantized_dimension, const std::vector< float > &data, IMemoryManager *memory_manager) |
Create channel-wise quantized tensor. | |
template<typename T > | |
constexpr DataType | getElementType () |
template<typename T > | |
std::vector< T > | extractTensorData (const Tensor &tensor) |
template<typename T > | |
std::vector< float > | dequantize (const T *data, size_t num_elements, float scale, int32_t zero_point) |
template<typename T > | |
std::pair< float, int32_t > | quantizationParams (float f_min, float f_max) |
float | getTolerance (float min, float max, int quantize_steps) |
std::vector< float > luci_interpreter::kernels::testing::dequantize | ( | const T * | data, |
size_t | num_elements, | ||
float | scale, | ||
int32_t | zero_point | ||
) |
Definition at line 201 of file TestUtils.h.
References flatbuffers::data().
Referenced by dequantizeTensorData().
std::vector< float > luci_interpreter::kernels::testing::dequantizeTensorData | ( | const Tensor & | tensor | ) |
Definition at line 39 of file TestUtils.cpp.
References flatbuffers::data(), dequantize(), luci_interpreter::Shape::dim(), luci_interpreter::Shape::num_dims(), luci_interpreter::Shape::num_elements(), and offset().
std::vector< T > luci_interpreter::kernels::testing::extractTensorData | ( | const Tensor & | tensor | ) |
Definition at line 161 of file TestUtils.h.
std::vector< int32_t > luci_interpreter::kernels::testing::extractTensorShape | ( | const Tensor & | tensor | ) |
Definition at line 115 of file TestUtils.cpp.
testing::Matcher< std::vector< float > > luci_interpreter::kernels::testing::FloatArrayNear | ( | const std::vector< float > & | values, |
float | max_abs_error | ||
) |
Definition at line 104 of file TestUtils.cpp.
|
constexpr |
Definition at line 134 of file TestUtils.h.
|
inline |
Definition at line 288 of file TestUtils.h.
Tensor luci_interpreter::kernels::testing::makeInputTensor | ( | const Shape & | shape, |
const std::vector< float > & | scales, | ||
const std::vector< int32_t > & | zero_points, | ||
int | quantized_dimension, | ||
const std::vector< float > & | data, | ||
IMemoryManager * | memory_manager | ||
) |
Create channel-wise quantized tensor.
DT | base integer data type, for example DataType::U8, DataType::S16, DataType::S64 |
shape | desired tensor shape |
scales | scales of quantized number |
zero_points | zero points of quantized number, should be 0 for signed datatypes |
quantize_dimension | dimension to apply quantization along. Usually channels/output channels |
data | floating point data for quantization |
memory_manager | memory manager for allocating memory to tensor |
Definition at line 85 of file TestUtils.h.
References luci_interpreter::IMemoryManager::allocate_memory(), flatbuffers::data(), luci_interpreter::Shape::dim(), luci_interpreter::Shape::num_dims(), luci_interpreter::Shape::num_elements(), and offset().
Tensor luci_interpreter::kernels::testing::makeInputTensor | ( | const Shape & | shape, |
const std::vector< typename DataTypeImpl< DT >::Type > & | data, | ||
IMemoryManager * | memory_manager | ||
) |
Definition at line 41 of file TestUtils.h.
References luci_interpreter::IMemoryManager::allocate_memory(), and flatbuffers::data().
Tensor luci_interpreter::kernels::testing::makeInputTensor | ( | const Shape & | shape, |
float | scale, | ||
int32_t | zero_point, | ||
const std::vector< float > & | data, | ||
IMemoryManager * | memory_manager | ||
) |
Create layer-wise quantized tensor.
DT | base integer data type, for example DataType::U8, DataType::S16, DataType::S64 |
shape | desired tensor shape |
scale | scale of quantized number |
zero_point | zero point of quantized number, should be 0 for signed datatypes |
data | floating point data for quantization |
memory_manager | memory manager for allocating memory to tensor |
Definition at line 61 of file TestUtils.h.
References luci_interpreter::IMemoryManager::allocate_memory(), and flatbuffers::data().
Definition at line 32 of file TestUtils.cpp.
Tensor luci_interpreter::kernels::testing::makeOutputTensor | ( | DataType | element_type, |
float | scale, | ||
int32_t | zero_point | ||
) |
Definition at line 34 of file TestUtils.cpp.
std::pair< float, int32_t > luci_interpreter::kernels::testing::quantizationParams | ( | float | f_min, |
float | f_max | ||
) |
Definition at line 214 of file TestUtils.h.
std::vector< T > luci_interpreter::kernels::testing::quantize | ( | const float * | data, |
size_t | num_elements, | ||
float | scale, | ||
int32_t | zero_point | ||
) |
Definition at line 174 of file TestUtils.h.
References flatbuffers::data().