Float16
For conceptual model usage and type mapping, see:
- class pyrogue.Float16(bitSize)[source]
Model class for 16-bit half-precision floating point numbers.
- Parameters:
bitSize (
int) – Number of bits being represented. Must be 16.args (Any)
kwargs (Any)
- Return type:
Any
- toBytes(value)[source]
Convert a python float value to a byte array.
- Parameters:
value (
float) – Python float value to convert.- Returns:
Byte array representation of the value.
- Return type:
Notes
Uses
struct.packwith IEEE 754 round-to-nearest-even. The C++ Block path (floatToHalf) uses truncation instead, so values that fall on a rounding boundary may differ by 1 ULP between the two paths.