TorchLean API

FloatLib.Floats.Formats.FiniteOnly.E5M2FNUZ

Finite-only E5M2FNUZ #

FloatLib.Floats.E5M2FNUZ gives the ONNX finite, NaN-supporting, unsigned-zero E5M2 variant a distinct Lean type, with type-level identity E5M2FNUZ.Family. That identity prevents accidental interchange with OCP E5M2, whose infinity and signed zero behavior differs even though both formats occupy one byte.

The runtime carrier is one UInt8. Balanced and throughput policies select exhaustive proved byte tables for addition, subtraction, multiplication, division, and square root. The latency policy uses the exact arithmetic baseline. Fused multiply-add uses the proved generic single-rounding kernel.

Reference #

Type-level identity of E5M2FNUZ, selecting its descriptor, carrier, and kernels.

    Instances For

      The E5M2FNUZ encoding fits in its direct byte carrier.

      @[instance_reducible, always_inline]

      Package the five byte tables with the proved arithmetic FMA baseline.

      @[instance_reducible, always_inline]
      @[reducible, inline]

      ONNX E5M2FNUZ: 5 exponent and 2 fraction bits with bias 16, one zero, no infinity, and the negative-zero code as the sole NaN. Values are stored in one byte and their arithmetic reads certified byte tables.

      Instances For
        @[inline]

        Construct E5M2FNUZ from a natural bit pattern, reduced to eight bits.

        Instances For
          @[inline]

          Read the complete E5M2FNUZ encoding byte.

          Instances For