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

Function compute_fft

utils/strand_util.py:451–472  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

449
450
451def 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
475def compute_ifft(input, spatial_size=256):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected