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}")