Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions
InferenceEngine::Precision Class Reference

This class holds precision value and provides precision related operations. More...

#include <ie_precision.hpp>

Public Types

enum   ePrecision : uint8_t {
  UNSPECIFIED = 255, MIXED = 0, FP32 = 10, FP16 = 11,
  Q78 = 20, I16 = 30, U8 = 40, I8 = 50,
  U16 = 60, I32 = 70, I64 = 72, BIN = 71,
  CUSTOM = 80
}
 

Public Member Functions

  Precision ()=default
  Default constructor.
 
  Precision (const Precision::ePrecision value)
  Constructor with specified precision.
 
  Precision (size_t bitsSize, const char *name=nullptr)
  Custom precision constructor. More...
 
template<class T >
bool  hasStorageType (const char *typeName=nullptr) const noexcept
  checks whether given storage class T can be used to store objects of current precision
 
bool  operator== (const Precision &p) const noexcept
  Equality operator with Precision object.
 
bool  operator== (const ePrecision p) const noexcept
  Equality operator with ePrecision enum value.
 
bool  operator!= (const ePrecision p) const noexcept
  Inequality operator with ePrecision enum value.
 
Precision operator= (const ePrecision p) noexcept
  Assignment operator with ePrecision enum value.
 
  operator bool () const noexcept
  Cast operator to a bool.
 
bool  operator! () const noexcept
  Logical negation operator.
 
  operator Precision::ePrecision () const noexcept
  Cast operator to a ePrecision.
 
const char *  name () const noexcept
  Getter of precision name.
 
size_t  size () const
  Returns size of single element of that precision in bits. More...
 
bool  is_float () const noexcept
  Checks if it is a floating point.
 

Static Public Member Functions

template<class T >
static Precision  fromType (const char *typeName=nullptr)
  Creates custom precision with specific underlined type.
 
static Precision  FromStr (const std::string &str)
  Creates from string with precision name.
 

Static Protected Member Functions

template<Precision::ePrecision precision>
static PrecisionInfo  makePrecisionInfo (const char *name)
  Returns PrecisionInfo by its name. More...
 
static bool  areSameStrings (const char *l, const char *r) noexcept
  Compare two c-strings. More...
 
static PrecisionInfo  getPrecisionInfo (ePrecision v)
  Return PrecisionInfo.
 

Detailed Description

This class holds precision value and provides precision related operations.

Member Enumeration Documentation

§ ePrecision

Enum to specify of different

Enumerator
UNSPECIFIED 

Unspecified value. Used by default

MIXED 

Mixed value. Can be received from network. No applicable for tensors

FP32 

32bit floating point value

FP16 

16bit floating point value

Q78 

16bit specific signed fixed point precision

I16 

16bit signed integer value

U8 

8bit unsigned integer value

I8 

8bit signed integer value

U16 

16bit unsigned integer value

I32 

32bit signed integer value

I64 

64bit signed integer value

BIN 

1bit integer value

CUSTOM 

custom precision has it's own name and size of elements

Constructor & Destructor Documentation

§ Precision()

InferenceEngine::Precision::Precision ( size_t  bitsSize,
const char *  name = nullptr 
)
inlineexplicit

Custom precision constructor.

Parameters
bitsSize size of elements
name optional name string, used in serialisation

Member Function Documentation

§ areSameStrings()

static bool InferenceEngine::Precision::areSameStrings ( const char *  l,
const char *  r 
)
inlinestaticprotectednoexcept

Compare two c-strings.

Parameters
l Const pointer to first string
r Const pointer to another string
Returns
True if strings are the same

§ makePrecisionInfo()

template<Precision::ePrecision precision>
static PrecisionInfo InferenceEngine::Precision::makePrecisionInfo ( const char *  name )
staticprotected

Returns PrecisionInfo by its name.

Parameters
name Name of precision

§ size()

size_t InferenceEngine::Precision::size ( ) const
inline

Returns size of single element of that precision in bits.

Returns
Number of bits per element

The documentation for this class was generated from the following file: