From 357017488a9e6e765597256c0eb532a5f98d518b Mon Sep 17 00:00:00 2001 From: grantbuster Date: Tue, 12 Nov 2024 12:07:28 -0700 Subject: [PATCH] optimizer state values should be taken as mean absolute otherwise you could underestimate changes --- sup3r/models/abstract.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sup3r/models/abstract.py b/sup3r/models/abstract.py index 0ea836135..596fbe63e 100644 --- a/sup3r/models/abstract.py +++ b/sup3r/models/abstract.py @@ -1071,7 +1071,8 @@ def get_optimizer_state(cls, optimizer): state = {'learning_rate': lr} for var in optimizer.variables: name = var.name - var = var.numpy().flatten().mean() # collapse ndarrays + var = var.numpy().flatten() + var = np.abs(var).mean() # collapse ndarrays into mean absolute state[name] = float(var) return state