Skip to content

Commit

Permalink
skip torch versions < 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Feb 7, 2025
1 parent 77d004e commit 533e027
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/float8/test_float8_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import torch

from torchao.float8.float8_utils import _round_scale_down_to_power_of_2
from torchao.utils import TORCH_VERSION_AT_LEAST_2_5

if not TORCH_VERSION_AT_LEAST_2_5:
pytest.skip("Unsupported PyTorch version", allow_module_level=True)


# source for notable single-precision cases:
Expand Down Expand Up @@ -33,6 +37,11 @@ def test_round_scale_down_to_power_of_2_valid_inputs(
torch.tensor(expected_result).cuda(),
)
result = _round_scale_down_to_power_of_2(input_tensor)

print(f"input: {input}")
print(f"input tensor: {input_tensor}")
print(f"result: {result}")
print(f"expected_result: {expected_result}")
assert (
torch.equal(result, expected_tensor)
or (result.isnan() and expected_tensor.isnan())
Expand Down

0 comments on commit 533e027

Please sign in to comment.