Skip to content

Commit

Permalink
Skip tests for old pytorch versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed May 17, 2024
1 parent 8c03bfc commit f2d03ea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/brevitas/quant_tensor/test_quant_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# SPDX-License-Identifier: BSD-3-Clause
from enum import Enum

from packaging import version
import pytest
import torch

from brevitas.inject.enum import QuantType
from brevitas import torch_version
from brevitas.nn import QuantIdentity
from brevitas.quant.experimental.float_quant_ocp import Fp8e5m2OCPActPerTensorFloat
from brevitas.quant_tensor import FloatQuantTensor
from brevitas.quant_tensor import IntQuantTensor
from brevitas.quant_tensor import QuantTensor


class Operator(Enum):
Expand Down Expand Up @@ -49,6 +49,10 @@ def test_quant_tensor_init():
'op', [Operator.ADD, Operator.SUBTRACT, Operator.DIVIDE, Operator.MULTIPLY, Operator.MATMUL])
@pytest.mark.parametrize('quant_fn', [to_quant_tensor, to_float_quant_tensor])
def test_quant_tensor_operators(op, quant_fn):

if quant_fn == to_float_quant_tensor and torch_version < version.parse('1.13'):
pytest.skip("Torch 1.13 is required for JIT to be compatible with FloatQuantTensor")

# Avoid 0 values
x = 1 + torch.rand(4, 4)

Expand Down

0 comments on commit f2d03ea

Please sign in to comment.