mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user