Skip to content

Commit 47ae9fe

Browse files
committed
standardize random hadamard
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
1 parent 9d0518b commit 47ae9fe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/compressed_tensors/transform/utils/hadamard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _matmul_hadU(X, transpose=False) -> torch.Tensor:
128128
input = hadK.view(1, K, K).to(input) @ input
129129

130130
# normalize
131-
return input.view(X.shape) / torch.tensor(n).sqrt()
131+
return input.view(X.shape)
132132

133133

134134
def _is_pow2(n: int) -> bool:

tests/test_transform/utils/test_hadamards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_packed_hadamard_compliant(had_func):
4646
def test_random_hadamard_matrix_compliant(size):
4747
had_matrix = random_hadamard_matrix(size)
4848
val_1 = torch.round(had_matrix @ had_matrix.T)
49-
assert torch.equal(val_1, torch.eye(size))
49+
assert torch.equal(val_1 / size, torch.eye(size))
5050

5151

5252
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)