diff --git a/setup.py b/setup.py index bb43acd..515bad0 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name = 'vector_quantize_pytorch', packages = find_packages(), - version = '1.12.11', + version = '1.12.12', license='MIT', description = 'Vector Quantization - Pytorch', long_description_content_type = 'text/markdown', diff --git a/vector_quantize_pytorch/finite_scalar_quantization.py b/vector_quantize_pytorch/finite_scalar_quantization.py index ab79a4b..7586bb2 100644 --- a/vector_quantize_pytorch/finite_scalar_quantization.py +++ b/vector_quantize_pytorch/finite_scalar_quantization.py @@ -82,7 +82,7 @@ def __init__( def bound(self, z: Tensor, eps: float = 1e-3) -> Tensor: """Bound `z`, an array of shape (..., d).""" - half_l = (self._levels - 1) * (1 - eps) / 2 + half_l = (self._levels - 1) * (1 + eps) / 2 offset = torch.where(self._levels % 2 == 0, 0.5, 0.0) shift = (offset / half_l).atanh() return (z + shift).tanh() * half_l - offset