Class InferenceEngine::Precision¶
-
class Precision¶
This class holds precision value and provides precision related operations.
Public Types
-
enum ePrecision¶
Enum to specify of different
Values:
-
enumerator UNSPECIFIED¶
Unspecified value. Used by default
-
enumerator MIXED¶
Mixed value. Can be received from network. No applicable for tensors
-
enumerator FP32¶
32bit floating point value
-
enumerator FP16¶
16bit floating point value, 5 bit for exponent, 10 bit for mantisa
-
enumerator BF16¶
16bit floating point value, 8 bit for exponent, 7 bit for mantisa
-
enumerator FP64¶
64bit floating point value
-
enumerator NF4¶
4bit normalized float value
-
enumerator Q78¶
16bit specific signed fixed point precision
-
enumerator I16¶
16bit signed integer value
-
enumerator U4¶
4bit unsigned integer value
-
enumerator U8¶
8bit unsigned integer value
-
enumerator I4¶
4bit signed integer value
-
enumerator I8¶
8bit signed integer value
-
enumerator U16¶
16bit unsigned integer value
-
enumerator I32¶
32bit signed integer value
-
enumerator U32¶
32bit unsigned integer value
-
enumerator I64¶
64bit signed integer value
-
enumerator U64¶
64bit unsigned integer value
-
enumerator BIN¶
1bit integer value
-
enumerator BOOL¶
8bit bool type
-
enumerator STRING¶
string type, std::string in C++
-
enumerator CUSTOM¶
custom precision has it’s own name and size of elements
-
enumerator UNSPECIFIED¶
Public Functions
-
Precision() = default¶
Default constructor.
-
inline Precision(const Precision::ePrecision value)¶
Constructor with specified precision.
- Parameters
value – A value of ePrecision to create an object from
-
inline explicit Precision(size_t bitsSize, const char *name = nullptr)¶
Custom precision constructor.
- Parameters
bitsSize – size of elements
name – optional: name string, used in serialisation
-
template<class T>
inline bool hasStorageType(const char *typeName = nullptr) const noexcept¶ checks whether given storage class T can be used to store objects of current precision
- Parameters
typeName – A string name of precision
- Returns
true
iftypeName
has underlaying storage type
-
inline bool operator==(const Precision &p) const noexcept¶
Equality operator with Precision object.
- Parameters
p – A value of Precision to compare with
- Returns
true
if values represent the same precisions,false
otherwise
-
inline bool operator!=(const Precision &p) const noexcept¶
Inequality operator with Precision object.
- Parameters
p – A value of Precision to compare with
- Returns
true
if values represent different precisions,false
otherwise
-
inline bool operator==(const ePrecision p) const noexcept¶
Equality operator with ePrecision enum value.
- Parameters
p – A value of ePrecision to compare with
- Returns
true
if values represent the same precisions,false
otherwise
-
inline bool operator!=(const ePrecision p) const noexcept¶
Inequality operator with ePrecision enum value.
- Parameters
p – A value of ePrecision to compare with
- Returns
true
if values represent different precisions,false
otherwise
-
inline Precision &operator=(const ePrecision p) noexcept¶
Assignment operator with ePrecision enum value.
- Parameters
p – A value of ePrecision enumeration
- Returns
A Precision instance
-
inline explicit operator bool() const noexcept¶
Cast operator to a bool.
- Returns
true
if precision is specified,false
otherwise
-
inline bool operator!() const noexcept¶
Logical negation operator.
- Returns
true
if precision is NOT specified,false
otherwise
-
inline operator Precision::ePrecision() const noexcept¶
Cast operator to a ePrecision.
- Returns
A casted value of Precision::ePrecision enumeration
-
inline constexpr uint8_t getPrecVal() const noexcept¶
Gets the precision value of type ePrecision.
- Returns
The preccision value.
-
inline const char *name() const noexcept¶
Getter of precision name.
- Returns
A string representing precision name
-
inline size_t size() const¶
Returns size of single element of that precision in bytes.
- Returns
Number of bytes per element
-
inline size_t bitsSize() const¶
Returns size of single element of that precision in bits.
- Returns
Number of bits per element
-
inline bool is_float() const noexcept¶
Checks if it is a floating point value.
- Returns
True if precision is float point,
false
otherwise
-
inline bool isSigned() const noexcept¶
Checks if it is a signed value.
- Returns
True if precision is signed,
false
otherwise
-
enum ePrecision¶