MCPcopy Index your code
hub / github.com/Extraltodeus/DistanceSampler / normalize_adjust

Function normalize_adjust

custom_samplers.py:63–73  ·  view source on GitHub ↗
(a,b,strength=1)

Source from the content-addressed store, hash-verified

61
62@torch.no_grad()
63def normalize_adjust(a,b,strength=1):
64 c = a.clone()
65 norm_a = a.norm(dim=1,keepdim=True)
66 a = a / norm_a
67 b = b / b.norm(dim=1,keepdim=True)
68 d = mmnorm((a - b).abs())
69 a = a - b * d * strength
70 a = a * norm_a / a.norm(dim=1,keepdim=True)
71 if a.isnan().any():
72 a[~torch.isfinite(a)] = c[~torch.isfinite(a)]
73 return a
74
75def get_ancestral_step_ext(sigma, sigma_next, eta=1.0, is_rf=False):
76 if sigma_next == 0 or eta == 0:

Callers 1

sample_distance_advancedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected