MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / freq_weight_1d

Function freq_weight_1d

k_diffusion/layers.py:27–32  ·  view source on GitHub ↗
(n, scales=0, dtype=None, device=None)

Source from the content-addressed store, hash-verified

25
26@lru_cache
27def freq_weight_1d(n, scales=0, dtype=None, device=None):
28 ramp = torch.linspace(0.5 / n, 0.5, n, dtype=dtype, device=device)
29 weights = -torch.log2(ramp)
30 if scales >= 1:
31 weights = torch.clamp_max(weights, scales)
32 return weights
33
34
35@lru_cache

Callers 1

freq_weight_ndFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected