()
| 90 | |
| 91 | |
| 92 | def test_bitlinear_weight_sign(): |
| 93 | layer = BitLinear(10, 20) |
| 94 | input_tensor = torch.randn(5, 10) |
| 95 | output_before = layer(input_tensor) |
| 96 | layer.weight.data = torch.abs(layer.weight.data) |
| 97 | output_after = layer(input_tensor) |
| 98 | assert not torch.allclose(output_before, output_after) |
| 99 | |
| 100 | |
| 101 | @pytest.mark.parametrize("groups", [1, 2, 5]) |