MCPcopy Create free account
hub / github.com/apple/coremltools / GetFloat

Method GetFloat

mlmodel/src/MILBlob/Fp8.cpp:70–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70float Fp8E5M2::GetFloat() const
71{
72 FloatCast fp32 = {.f = 0};
73 // Set the sign bit.
74 fp32.components.sign = data.components.sign;
75
76 // Standard NaN/Inf case. We just use the fp8 mantissa as there's
77 // no strong requirements for mantissa in the NaN case.
78 if (data.components.exponent == (0x1 << fp8ExponentBits) - 1) {
79 fp32.components.exponent = 0xFF;
80 fp32.components.mantissa = data.components.mantissa;
81 return fp32.f;
82 }
83 HandleFp8ToFp32ExponentMantissa<Fp8E5M2, Fp8E5M2::Cast>(data, fp32);
84 HandleFp8ToFp32Denormalize(data, fp32);
85 return fp32.f;
86}
87
88float Fp8E4M3FN::GetFloat() const
89{

Calls 1