Deeploy.CommonExtensions.DataTypes.float16_t
- class Deeploy.CommonExtensions.DataTypes.float16_t(value: int | float | Immediate, ctxt: _NetworkContext | None = None)
Bases:
FloatImmediate
Methods
__init__
(value[, ctxt])checkPromotion
(value[, ctxt])Checks whether a given Python-typed or Deeploy-typed value can be represented with the Deeploy type
checkValue
(value[, ctxt])This method tries to manually cast standard python's standard immediate float precision values (64 bits) to an arbitrary FP representation and check if the new representation is close enough to the original value.
partialOrderUpcast
(otherCls)This method checks whether a data type (cls) can be used to represent any value that can be represented by another data type (otherCls).
Attributes
value
Represents the number of bits reserved for the exponent part
typeExponentMax
typeExponentOffset
Represents the number of bits reserved for the mantissa part
typeMin
The C typename of this type
the number of BITS to be assigned to the type
- typeName: str = 'float16_t'
The C typename of this type
- Type:
str
- typeWidth: int = 16
the number of BITS to be assigned to the type
- Type:
int
- typeMantissa: int = 10
Represents the number of bits reserved for the mantissa part
- Type:
int
- typeExponent: int = 5
Represents the number of bits reserved for the exponent part
- Type:
int
- classmethod checkPromotion(value: _PythonType | Immediate, ctxt: _NetworkContext | None = None)
Checks whether a given Python-typed or Deeploy-typed value can be represented with the Deeploy type
- Parameters:
value (Union[_PythonType, _DeeployType]) – Python-typed or Deeploy-typed value to be checked for promotion to cls
ctxt (Optional[_NetworkContext]) – Current NetworkContext
- Returns:
Returns true if the value can be promoted to cls
- Return type:
bool
- classmethod checkValue(value: float | Iterable[float] | ndarray, ctxt: _NetworkContext | None = None)
This method tries to manually cast standard python’s standard immediate float precision values (64 bits) to an arbitrary FP representation and check if the new representation is close enough to the original value.
- classmethod partialOrderUpcast(otherCls: Type[Immediate]) bool
This method checks whether a data type (cls) can be used to represent any value that can be represented by another data type (otherCls). For more information on partial order sets and type conversion, check:https://en.wikipedia.org/wiki/Partially_ordered_set https://en.wikipedia.org/wiki/Type_conversion
- Parameters:
otherCls (Type[Immediate]) – The class you want to upcast an immediate of this cls to
- Returns:
Returns true if this cls can be statically promoted to otherCls
- Return type:
bool