From 248d83a470341a7b6a4cf24f2b8ea77f91e000d2 Mon Sep 17 00:00:00 2001 From: Nick Fraser Date: Mon, 16 Dec 2024 17:12:38 +0000 Subject: [PATCH] Fix (float/clamp): Bugfix when unsigned --- src/brevitas/core/function_wrapper/clamp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/brevitas/core/function_wrapper/clamp.py b/src/brevitas/core/function_wrapper/clamp.py index 163e63a22..5751ea3eb 100644 --- a/src/brevitas/core/function_wrapper/clamp.py +++ b/src/brevitas/core/function_wrapper/clamp.py @@ -152,7 +152,7 @@ def forward( # Compute masks inf_mask = x.isinf() p_max_val_mask = x > max_value - n_max_val_mask = -x > max_value + n_max_val_mask = x < min_value # first clamp everything to +- max_value, basically the saturating case x = self.saturating_clamp(x, max_value, min_value)