Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/gpu/torch/quantization/backends/test_gemm_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
set_seed()


@pytest.fixture(autouse=True)
def setup_seed():
"""Set seed before each test function."""
set_seed()


@pytest.mark.parametrize(
("config", "gemm_forward", "atol", "rtol"),
[
Expand Down Expand Up @@ -257,9 +263,9 @@ def forward_loop(model, run_backward=False):

# The way the compression of the weights and inputs might be different.
# E.g. we may use torch.compile in the gemms.
assert torch.allclose(output_dynamic_quant_gemm, output_dynamic_quant, atol=atol / 3)
assert torch.allclose(output_calib_quant_gemm, output_calib_quant, atol=atol / 3)
assert torch.allclose(output_dynamic_quant_gemm, output_dynamic_quant, atol=atol / 2)
assert torch.allclose(output_calib_quant_gemm, output_calib_quant, atol=atol / 2)
assert torch.allclose(
output_dynamic_quant_gemm, output_dynamic_quant_compressed, atol=atol / 3
output_dynamic_quant_gemm, output_dynamic_quant_compressed, atol=atol / 2
)
assert torch.allclose(output_calib_quant_gemm, output_calib_quant_compressed, atol=atol / 3)
assert torch.allclose(output_calib_quant_gemm, output_calib_quant_compressed, atol=atol / 2)