From 5dcf1f980fe2693e7ed43b257288bb92a325b43e Mon Sep 17 00:00:00 2001 From: spacepxl Date: Tue, 9 Jan 2024 18:05:57 -0500 Subject: [PATCH] fixed the math on ClampOutliers node --- nodes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nodes.py b/nodes.py index 43faa66..653e0e8 100644 --- a/nodes.py +++ b/nodes.py @@ -448,7 +448,7 @@ class ClampOutliers: return { "required": { "latents": ("LATENT", ), - "std_dev": ("FLOAT", {"default": 3.0, "min": 0.1, "max": 8.0, "step": 0.1, "round": 0.1}), + "std_dev": ("FLOAT", {"default": 3.0, "min": 0.1, "max": 100.0, "step": 0.1, "round": 0.1}), }, } @@ -463,8 +463,8 @@ class ClampOutliers: for i, latent in enumerate(t): for j, channel in enumerate(latent): - sd = torch.std(channel, dim=None).numpy() - t[i,j] = torch.clamp(channel, min = -sd * std_dev, max = sd * std_dev) + sd, mean = torch.std_mean(channel, dim=None) + t[i,j] = torch.clamp(channel, min = -sd * std_dev + mean, max = sd * std_dev + mean) latents_copy["samples"] = t return (latents_copy,)