Skip to content

Commit

Permalink
Fix sign mask
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chu <justinchu@microsoft.com>
  • Loading branch information
justinchuby committed May 4, 2024
1 parent 4c18a15 commit c4545cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions onnx/numpy_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def float8e4m3_to_float32(

# Construct the float32 value
# First move the sign bit to the correct position
result[finite_mask] = signs << 24
result[finite_mask] = signs[finite_mask] << 24
# Subnormal number
# if mantissa > 0:
# exponent = 127 - exponent_bias
Expand Down Expand Up @@ -225,7 +225,7 @@ def float8e5m2_to_float32(

# Construct the float32 value
# First move the sign bit to the correct position
result[finite_mask] = signs << 24
result[finite_mask] = signs[finite_mask] << 24
# if exponent == 0:
# # Subnormal number
# if mantissa > 0:
Expand Down

0 comments on commit c4545cf

Please sign in to comment.