(input)
| 449 | |
| 450 | |
| 451 | def compute_fft(input): |
| 452 | if len(input.shape)==2: |
| 453 | #we have a (B,T) input so we can just run stft |
| 454 | x_fft = torch.fft.rfft( |
| 455 | input, |
| 456 | ) |
| 457 | elif len(input.shape)==3: |
| 458 | #do stft for each dimension |
| 459 | dim=input.shape[-1] |
| 460 | fft_total=[] |
| 461 | for i in range(dim): |
| 462 | input_axis = input[:,:,i] |
| 463 | x_fft = torch.fft.rfft( |
| 464 | input_axis, |
| 465 | ).unsqueeze(-1) |
| 466 | fft_total.append(x_fft) |
| 467 | x_fft = torch.cat(fft_total,-1) |
| 468 | else: |
| 469 | return None |
| 470 | |
| 471 | |
| 472 | return x_fft |
| 473 | |
| 474 | #inverse of compute_stft |
| 475 | def compute_ifft(input, spatial_size=256): |
nothing calls this directly
no outgoing calls
no test coverage detected