From ee4487ac5a3d846162b0b543e7e6dce1fa9de3b8 Mon Sep 17 00:00:00 2001 From: Garrett Vanhoy Date: Mon, 18 Sep 2023 10:02:51 -0400 Subject: [PATCH] Added eps --- torchsig/transforms/functional.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/torchsig/transforms/functional.py b/torchsig/transforms/functional.py index b99dc65..3f084a4 100644 --- a/torchsig/transforms/functional.py +++ b/torchsig/transforms/functional.py @@ -1026,7 +1026,10 @@ def quantize( """ # Setup quantization resolution/bins - max_value = max(np.abs(np.real(np.copy(tensor)),np.imag(np.copy(tensor)))) + 1e-9 + max_value = ( + max(np.abs(np.real(np.copy(tensor)), np.imag(np.copy(tensor)))) + + np.finfo(np.dtype(np.float64)).eps + ) bins = np.linspace(-max_value, max_value, num_levels + 1) # Digitize to bins