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
OpenDAS
Torchaudio
Commits
a87b33db
Unverified
Commit
a87b33db
authored
Jun 02, 2021
by
Caroline Chen
Committed by
GitHub
Jun 02, 2021
Browse files
Reformat resample docs (#1548)
parent
c22d9bb8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
docs/source/functional.rst
docs/source/functional.rst
+5
-5
torchaudio/functional/functional.py
torchaudio/functional/functional.py
+4
-3
torchaudio/transforms.py
torchaudio/transforms.py
+6
-5
No files found.
docs/source/functional.rst
View file @
a87b33db
...
@@ -56,6 +56,11 @@ apply_codec
...
@@ -56,6 +56,11 @@ apply_codec
.. autofunction:: apply_codec
.. autofunction:: apply_codec
resample
--------
.. autofunction:: resample
:hidden:`Complex Utility`
:hidden:`Complex Utility`
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
...
@@ -230,8 +235,3 @@ vad
...
@@ -230,8 +235,3 @@ vad
---------------------------
---------------------------
.. autofunction:: spectral_centroid
.. autofunction:: spectral_centroid
:hidden:`resample`
---------------------------
.. autofunction:: resample
torchaudio/functional/functional.py
View file @
a87b33db
...
@@ -1428,6 +1428,10 @@ def resample(
...
@@ -1428,6 +1428,10 @@ def resample(
https://ccrma.stanford.edu/~jos/resample/Theory_Ideal_Bandlimited_Interpolation.html
https://ccrma.stanford.edu/~jos/resample/Theory_Ideal_Bandlimited_Interpolation.html
Note:
``transforms.Resample`` precomputes and reuses the resampling kernel, so using it will result in
more efficient computation if resampling multiple waveforms with the same resampling parameters.
Args:
Args:
waveform (Tensor): The input signal of dimension (..., time)
waveform (Tensor): The input signal of dimension (..., time)
orig_freq (float): The original frequency of the signal
orig_freq (float): The original frequency of the signal
...
@@ -1442,9 +1446,6 @@ def resample(
...
@@ -1442,9 +1446,6 @@ def resample(
Returns:
Returns:
Tensor: The waveform at the new frequency of dimension (..., time).
Tensor: The waveform at the new frequency of dimension (..., time).
Note: ``transforms.Resample`` precomputes and reuses the resampling kernel, so using it will result in
more efficient computation if resampling multiple waveforms with the same resampling parameters.
"""
"""
assert
orig_freq
>
0.0
and
new_freq
>
0.0
assert
orig_freq
>
0.0
and
new_freq
>
0.0
...
...
torchaudio/transforms.py
View file @
a87b33db
...
@@ -663,6 +663,12 @@ class MuLawDecoding(torch.nn.Module):
...
@@ -663,6 +663,12 @@ class MuLawDecoding(torch.nn.Module):
class
Resample
(
torch
.
nn
.
Module
):
class
Resample
(
torch
.
nn
.
Module
):
r
"""Resample a signal from one frequency to another. A resampling method can be given.
r
"""Resample a signal from one frequency to another. A resampling method can be given.
Note:
If resampling on waveforms of higher precision than float32, there may be a small loss of precision
because the kernel is cached once as float32. If high precision resampling is important for your application,
the functional form will retain higher precision, but run slower because it does not cache the kernel.
Alternatively, you could rewrite a transform that caches a higher precision kernel.
Args:
Args:
orig_freq (float, optional): The original frequency of the signal. (Default: ``16000``)
orig_freq (float, optional): The original frequency of the signal. (Default: ``16000``)
new_freq (float, optional): The desired frequency. (Default: ``16000``)
new_freq (float, optional): The desired frequency. (Default: ``16000``)
...
@@ -673,11 +679,6 @@ class Resample(torch.nn.Module):
...
@@ -673,11 +679,6 @@ class Resample(torch.nn.Module):
rolloff (float, optional): The roll-off frequency of the filter, as a fraction of the Nyquist.
rolloff (float, optional): The roll-off frequency of the filter, as a fraction of the Nyquist.
Lower values reduce anti-aliasing, but also reduce some of the highest frequencies. (Default: ``0.99``)
Lower values reduce anti-aliasing, but also reduce some of the highest frequencies. (Default: ``0.99``)
beta (float or None): The shape parameter used for kaiser window.
beta (float or None): The shape parameter used for kaiser window.
Note: If resampling on waveforms of higher precision than float32, there may be a small loss of precision
because the kernel is cached once as float32. If high precision resampling is important for your application,
the functional form will retain higher precision, but run slower because it does not cache the kernel.
Alternatively, you could rewrite a transform that caches a higher precision kernel.
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
...
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