Skip to content

Commit 17a3bbf

Browse files
authored
Add example for GriffinLim (#1671)
1 parent 1d6b15e commit 17a3bbf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

torchaudio/transforms.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ class GriffinLim(torch.nn.Module):
155155
Values near 1 can lead to faster convergence, but above 1 may not converge. (Default: ``0.99``)
156156
length (int, optional): Array length of the expected output. (Default: ``None``)
157157
rand_init (bool, optional): Initializes phase randomly if True and to zero otherwise. (Default: ``True``)
158+
159+
Example
160+
>>> batch, freq, time = 2, 257, 100
161+
>>> spectrogram = torch.randn(batch, freq, time)
162+
>>> transform = transforms.GriffinLim(n_fft=512)
163+
>>> waveform = transform(spectrogram)
158164
"""
159165
__constants__ = ['n_fft', 'n_iter', 'win_length', 'hop_length', 'power',
160166
'length', 'momentum', 'rand_init']

0 commit comments

Comments
 (0)