From 0145613681c76f2ff5519c3b7f360d282fbeca8d Mon Sep 17 00:00:00 2001 From: Manuel Candales Date: Mon, 2 Feb 2026 18:55:04 -0500 Subject: [PATCH] Update [ghstack-poisoned] --- backends/apple/metal/tests/test_modules.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/backends/apple/metal/tests/test_modules.py b/backends/apple/metal/tests/test_modules.py index 6dceaa5fc9b..7f12963ace6 100644 --- a/backends/apple/metal/tests/test_modules.py +++ b/backends/apple/metal/tests/test_modules.py @@ -251,6 +251,30 @@ def forward(self, x: torch.Tensor): } +# ------------------------------------------------------------------------- +class LinearWithBiasInt4(nn.Module): + def __init__(self): + super().__init__() + self.linear = nn.Linear(128, 256, bias=True) + + def forward(self, x: torch.Tensor): + return self.linear(x) + + +MODULE_REGISTRY["linear_bias_int4"] = { + "model_class": LinearWithBiasInt4, + "input_shapes": [(127, 128)], + "description": "Linear layer with bias and int4 quantization", + "qlinear": "fpa4w", + "qlinear_group_size": 32, + "compare_to_unquantized": False, + "atol_float32": 5e-2, + "rtol_float32": 5e-2, + "atol_bfloat16": 1e-1, + "rtol_bfloat16": 1e-1, + "skip": not TORCHAO_AVAILABLE, +} + # ------------------------------------------------------------------------- # Convolution Modules # -------------------------------------------------------------------------