MCPcopy Create free account
hub / github.com/Vchitect/Latte / construct_log_spaced_freqs

Function construct_log_spaced_freqs

tools/utils/layers.py:439–446  ·  view source on GitHub ↗
(max_num_frames: int, skip_small_t_freqs: int=0)

Source from the content-addressed store, hash-verified

437#----------------------------------------------------------------------------
438
439def construct_log_spaced_freqs(max_num_frames: int, skip_small_t_freqs: int=0) -> Tuple[int, torch.Tensor]:
440 time_resolution = 2 ** np.ceil(np.log2(max_num_frames))
441 num_fourier_feats = np.ceil(np.log2(time_resolution)).astype(int)
442 powers = torch.tensor([2]).repeat(num_fourier_feats).pow(torch.arange(num_fourier_feats)) # [num_fourier_feats]
443 powers = powers[:len(powers) - skip_small_t_freqs] # [num_fourier_feats]
444 fourier_coefs = powers.unsqueeze(0).float() * np.pi # [1, num_fourier_feats]
445
446 return fourier_coefs / time_resolution
447
448#----------------------------------------------------------------------------

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected