Fix inverted lerp weights in slerp near-parallel shortcut

The nearly-parallel fast path interpolated in the wrong direction:
at val=0 it returned hi instead of lo, opposite to both the general
slerp formula below and the sibling near-orthogonal shortcut. Affects
subseed/variation strength when base and subseed noise are nearly
parallel.

https: //claude.ai/code/session_014QWKWgKvMevcuvfCnsYoT2
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-06-11 08:16:52 +00:00
committed by QualiaRain
parent 26a58b46fb
commit ace616d287
+1 -1
View File
@@ -183,7 +183,7 @@ def slerp(val, lo, hi): # from https://discuss.pytorch.org/t/help-regarding-sler
dot = (lo_norm * hi_norm).sum(1)
dot_mean = dot.mean()
if dot_mean > 0.9999: # simplifies slerp to lerp if vectors are nearly parallel
return lo * val + hi * (1 - val)
return lo * (1 - val) + hi * val
if dot_mean < 0.0001: # also simplifies slerp to lerp to avoid division-by-zero later on
return lo * (1.0 - val) + hi * val
omega = torch.acos(dot)