Fonction torch.istft de PyTorch
Manuel de référence Pytorch torch
torch.istftest une fonction de PyTorch utilisée pour la Transformée de Fourier à court terme inverse (ISTFT). Elle convertit la représentation dans le domaine fréquentiel en un signal temporel, et est utilisée conjointement avectorch.stftpour le traitement du signal.
Définition de fonction
torch.istft(input, n_fft, hop_length=None, win_length=None, window=None, center=True, normalized=False, onesided=True, length=None, return_complex=False)
Exemple d'utilisation
Exemple
import torch
# Effectuer d'abord la STFT, puis l'ISTFT
x = torch.randn(1, 16000)
window = torch.hann_window(512)
# Transformée de Fourier à court terme
stft_result = torch.stft(x, n_fft=512, hop_length=160, win_length=512, window=window)
# Transformée de Fourier à court terme inverse
reconstructed = torch.istft(stft_result, n_fft=512, hop_length=160, win_length=512, window=window, length=16000)
print("Forme du signal reconstruit :", reconstructed.shape)
# Effectuer d'abord la STFT, puis l'ISTFT
x = torch.randn(1, 16000)
window = torch.hann_window(512)
# Transformée de Fourier à court terme
stft_result = torch.stft(x, n_fft=512, hop_length=160, win_length=512, window=window)
# Transformée de Fourier à court terme inverse
reconstructed = torch.istft(stft_result, n_fft=512, hop_length=160, win_length=512, window=window, length=16000)
print("Forme du signal reconstruit :", reconstructed.shape)
Autres extensions