From 3e46d51df82a62990afa1dd99183ac18f3051f0d Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 6 Oct 2026 20:39:21 -0700 Subject: [PATCH] swift15: BF16 absmax bits belong in the HIGH half of the float32 --- scripts/verify-swift15-ple.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/verify-swift15-ple.py b/scripts/verify-swift15-ple.py index ec4f068..2d83010 100755 --- a/scripts/verify-swift15-ple.py +++ b/scripts/verify-swift15-ple.py @@ -57,9 +57,9 @@ for fname, keys in sorted(shards.items()): gfile = k mm.close() -# rebuild the BF16 value from the sign-cleared uint16 bit pattern -absmax = np.frombuffer(np.uint16(gmax).tobytes() + b"\x00\x00", - dtype=np.float32)[0] +# rebuild the BF16 value: the 16 bits are the HIGH half of the float32 +absmax = np.frombuffer(b"\x00\x00" + np.uint16(gmax).tobytes(), + dtype=np.float32)[0] cap = FP8_E4M3_MAX * SCALE print(f"absmax = {absmax!r} (tensor: {gfile})") print(f"2^log2 = 2^{math.log2(absmax):.3f}")