Skip to content

Commit 7bd7078

Browse files
committed
address #96
1 parent 078f005 commit 7bd7078

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
setup(
44
name = 'vector_quantize_pytorch',
55
packages = find_packages(),
6-
version = '1.12.4',
6+
version = '1.12.5',
77
license='MIT',
88
description = 'Vector Quantization - Pytorch',
99
long_description_content_type = 'text/markdown',

vector_quantize_pytorch/residual_fsq.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
def exists(val):
2020
return val is not None
2121

22+
def first(l):
23+
return l[0]
24+
2225
def default(val, d):
2326
return val if exists(val) else d
2427

@@ -59,7 +62,7 @@ def __init__(
5962
scales = []
6063

6164
for ind in range(num_quantizers):
62-
scales.append(levels_tensor ** -ind)
65+
scales.append((levels_tensor - 1) ** -ind)
6366

6467
fsq = FSQ(
6568
levels = levels,
@@ -146,7 +149,7 @@ def forward(
146149
x = self.project_in(x)
147150

148151
quantized_out = 0.
149-
residual = x
152+
residual = first(self.layers).bound(x)
150153

151154
all_indices = []
152155

0 commit comments

Comments
 (0)