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

Function compute_ifft

utils/strand_util.py:475–502  ·  view source on GitHub ↗
(input, spatial_size=256)

Source from the content-addressed store, hash-verified

473
474#inverse of compute_stft
475def compute_ifft(input, spatial_size=256):
476
477 #if the input if 4 dimensional and the last dimension 2, then we view it as complex
478 if len(input.shape)==4 and input.shape[-1]==2:
479 input=torch.view_as_complex(input)
480
481 if len(input.shape)==2:
482 #we have a (B,T) input so we can just run stft
483 x= torch.fft.irfft(
484 input,
485 )
486 elif len(input.shape)==3:
487 #do stft for each dimension
488 dim=input.shape[-1]
489 x_total=[]
490 for i in range(dim):
491 input_axis = input[:,:,i]
492 x_axis = torch.fft.irfft(
493 input_axis,
494 n=spatial_size,
495 ).unsqueeze(-1)
496 x_total.append(x_axis)
497 x = torch.cat(x_total,-1)
498 else:
499 return None
500
501
502 return x
503
504
505#strand positions should be [nr_strands,nr_verts,3]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected