Set of functions to convert from FP32 to FP16 and vice versa. More...
Typedefs | |
using | InferenceEngine::ie_fp16 = short |
A type difinition for FP16 data type. Defined as a singed short. | |
Functions | |
ie_fp16 | InferenceEngine::PrecisionUtils::f32tof16 (float x) |
Converts a single-precision floating point value to a half-precision floating poit value. More... | |
float | InferenceEngine::PrecisionUtils::f16tof32 (ie_fp16 x) |
Convers a half-precision floating point value to a single-precision floating point value. More... | |
void | InferenceEngine::PrecisionUtils::f16tof32Arrays (float *dst, const ie_fp16 *src, size_t nelem, float scale=1.f, float bias=0.f) |
Converts a half-precision floating point array to single-precision floating point array and applies scale and bias is needed. More... | |
void | InferenceEngine::PrecisionUtils::f32tof16Arrays (ie_fp16 *dst, const float *src, size_t nelem, float scale=1.f, float bias=0.f) |
Converts a single-precision floating point array to a half-precision floating point array and applies scale and bias if needed. More... | |
template<class OutT , class InT , typename std::enable_if< std::is_integral< OutT >::value &&std::is_integral< InT >::value &&std::is_signed< InT >::value &&!std::is_same< OutT, InT >::value >::type * = nullptr> | |
OutT | InferenceEngine::PrecisionUtils::saturate_cast (const InT &value) |
Converts one integral type to another saturating the result if the source value doesn't fit into destination type range. More... | |
template<class InT > | |
InT | InferenceEngine::PrecisionUtils::saturate_cast (const InT &value) |
Converts one integral type to another saturating the result if the source value doesn't fit into destination type range. More... | |
Set of functions to convert from FP32 to FP16 and vice versa.
float InferenceEngine::PrecisionUtils::f16tof32 | ( | ie_fp16 | x | ) |
Convers a half-precision floating point value to a single-precision floating point value.
[in] | x | A half-precision floating point value |
void InferenceEngine::PrecisionUtils::f16tof32Arrays | ( | float * | dst, |
const ie_fp16 * | src, | ||
size_t | nelem, | ||
float | scale = 1.f , |
||
float | bias = 0.f |
||
) |
Converts a half-precision floating point array to single-precision floating point array and applies scale
and bias
is needed.
dst | A destination array of single-precision floating point values | |
[in] | src | A source array of half-precision floating point values |
[in] | nelem | A number of elements in arrays |
[in] | scale | An optional scale parameter |
[in] | bias | An optional bias parameter |
ie_fp16 InferenceEngine::PrecisionUtils::f32tof16 | ( | float | x | ) |
Converts a single-precision floating point value to a half-precision floating poit value.
[in] | x | A single-precision floating point value |
void InferenceEngine::PrecisionUtils::f32tof16Arrays | ( | ie_fp16 * | dst, |
const float * | src, | ||
size_t | nelem, | ||
float | scale = 1.f , |
||
float | bias = 0.f |
||
) |
Converts a single-precision floating point array to a half-precision floating point array and applies scale
and bias
if needed.
dst | A destination array of half-precision floating point values | |
[in] | src | A sources array of single-precision floating point values |
[in] | nelem | A number of elements in arrays |
[in] | scale | An optional scale parameter |
[in] | bias | An optional bias parameter |
|
inline |
Converts one integral type to another saturating the result if the source value doesn't fit into destination type range.
value | Value to be converted |
|
inline |
Converts one integral type to another saturating the result if the source value doesn't fit into destination type range.
value | Value to be converted |