Skip to content

Commit 6102e37

Browse files
committed
address #106
1 parent 1155588 commit 6102e37

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
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.14.0',
6+
version = '1.14.1',
77
license='MIT',
88
description = 'Vector Quantization - Pytorch',
99
long_description_content_type = 'text/markdown',

vector_quantize_pytorch/vector_quantize_pytorch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def cdist(x, y):
3030
x2 = reduce(x ** 2, 'b n d -> b n', 'sum')
3131
y2 = reduce(y ** 2, 'b n d -> b n', 'sum')
3232
xy = einsum('b i d, b j d -> b i j', x, y) * -2
33-
return (rearrange(x2, 'b i -> b i 1') + rearrange(y2, 'b j -> b 1 j') + xy).sqrt()
33+
return (rearrange(x2, 'b i -> b i 1') + rearrange(y2, 'b j -> b 1 j') + xy).clamp(min = 0).sqrt()
3434

3535
def log(t, eps = 1e-20):
3636
return torch.log(t.clamp(min = eps))

0 commit comments

Comments
 (0)