Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
hehl2
Torchaudio
Commits
df776150
"docs/modules/engine.rst" did not exist on "5b3792fc3ef9ab6a6f8f30634ab2e52fb0941af3"
Unverified
Commit
df776150
authored
Jul 28, 2021
by
nateanl
Committed by
GitHub
Jul 28, 2021
Browse files
Fix examples in transforms (#1646)
parent
658e3a88
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
torchaudio/transforms.py
torchaudio/transforms.py
+9
-6
No files found.
torchaudio/transforms.py
View file @
df776150
...
@@ -430,8 +430,9 @@ class MelSpectrogram(torch.nn.Module):
...
@@ -430,8 +430,9 @@ class MelSpectrogram(torch.nn.Module):
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
Example
Example
>>> waveform, sample_rate = torchaudio.load('test.wav', normalization=True)
>>> waveform, sample_rate = torchaudio.load('test.wav', normalize=True)
>>> mel_specgram = transforms.MelSpectrogram(sample_rate)(waveform) # (channel, n_mels, time)
>>> transform = transforms.MelSpectrogram(sample_rate)
>>> mel_specgram = transform(waveform) # (channel, n_mels, time)
"""
"""
__constants__
=
[
'sample_rate'
,
'n_fft'
,
'win_length'
,
'hop_length'
,
'pad'
,
'n_mels'
,
'f_min'
]
__constants__
=
[
'sample_rate'
,
'n_fft'
,
'win_length'
,
'hop_length'
,
'pad'
,
'n_mels'
,
'f_min'
]
...
@@ -1150,8 +1151,9 @@ class SpectralCentroid(torch.nn.Module):
...
@@ -1150,8 +1151,9 @@ class SpectralCentroid(torch.nn.Module):
wkwargs (dict or None, optional): Arguments for window function. (Default: ``None``)
wkwargs (dict or None, optional): Arguments for window function. (Default: ``None``)
Example
Example
>>> waveform, sample_rate = torchaudio.load('test.wav', normalization=True)
>>> waveform, sample_rate = torchaudio.load('test.wav', normalize=True)
>>> spectral_centroid = transforms.SpectralCentroid(sample_rate)(waveform) # (channel, time)
>>> transform = transforms.SpectralCentroid(sample_rate)
>>> spectral_centroid = transform(waveform) # (channel, time)
"""
"""
__constants__
=
[
'sample_rate'
,
'n_fft'
,
'win_length'
,
'hop_length'
,
'pad'
]
__constants__
=
[
'sample_rate'
,
'n_fft'
,
'win_length'
,
'hop_length'
,
'pad'
]
...
@@ -1201,8 +1203,9 @@ class PitchShift(torch.nn.Module):
...
@@ -1201,8 +1203,9 @@ class PitchShift(torch.nn.Module):
If None, then ``torch.hann_window(win_length)`` is used (Default: ``None``).
If None, then ``torch.hann_window(win_length)`` is used (Default: ``None``).
Example
Example
>>> waveform, sample_rate = torchaudio.load('test.wav', normalization=True)
>>> waveform, sample_rate = torchaudio.load('test.wav', normalize=True)
>>> waveform_shift = transforms.PitchShift(sample_rate, 4)(waveform) # (channel, time)
>>> transform = transforms.PitchShift(sample_rate, 4)
>>> waveform_shift = transform(waveform) # (channel, time)
"""
"""
__constants__
=
[
'sample_rate'
,
'n_steps'
,
'bins_per_octave'
,
'n_fft'
,
'win_length'
,
'hop_length'
]
__constants__
=
[
'sample_rate'
,
'n_steps'
,
'bins_per_octave'
,
'n_fft'
,
'win_length'
,
'hop_length'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment