| 437 | #---------------------------------------------------------------------------- |
| 438 | |
| 439 | def 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 | #---------------------------------------------------------------------------- |