Unverified Commit 768432c3 authored by Caroline Chen's avatar Caroline Chen Committed by GitHub
Browse files

Standardize optional types in docstrings (#1746)

parent d9bfb708
...@@ -194,7 +194,7 @@ class InverseSpectrogram(torch.nn.Module): ...@@ -194,7 +194,7 @@ class InverseSpectrogram(torch.nn.Module):
r""" r"""
Args: Args:
spectrogram (Tensor): Complex tensor of audio of dimension (..., freq, time). spectrogram (Tensor): Complex tensor of audio of dimension (..., freq, time).
length (int, optional): The output length of the waveform. length (int or None, optional): The output length of the waveform.
Returns: Returns:
Tensor: Dimension (..., time), Least squares estimation of the original signal. Tensor: Dimension (..., time), Least squares estimation of the original signal.
...@@ -297,8 +297,8 @@ class AmplitudeToDB(torch.nn.Module): ...@@ -297,8 +297,8 @@ class AmplitudeToDB(torch.nn.Module):
Args: Args:
stype (str, optional): scale of input tensor ('power' or 'magnitude'). The stype (str, optional): scale of input tensor ('power' or 'magnitude'). The
power being the elementwise square of the magnitude. (Default: ``'power'``) power being the elementwise square of the magnitude. (Default: ``'power'``)
top_db (float, optional): minimum negative cut-off in decibels. A reasonable number top_db (float or None, optional): minimum negative cut-off in decibels. A reasonable
is 80. (Default: ``None``) number is 80. (Default: ``None``)
""" """
__constants__ = ['multiplier', 'amin', 'ref_value', 'db_multiplier'] __constants__ = ['multiplier', 'amin', 'ref_value', 'db_multiplier']
...@@ -340,7 +340,7 @@ class MelScale(torch.nn.Module): ...@@ -340,7 +340,7 @@ class MelScale(torch.nn.Module):
f_max (float or None, optional): Maximum frequency. (Default: ``sample_rate // 2``) f_max (float or None, optional): Maximum frequency. (Default: ``sample_rate // 2``)
n_stft (int, optional): Number of bins in STFT. See ``n_fft`` in :class:`Spectrogram`. (Default: ``201``) n_stft (int, optional): Number of bins in STFT. See ``n_fft`` in :class:`Spectrogram`. (Default: ``201``)
norm (str or None, optional): If 'slaney', divide the triangular mel weights by the width of the mel band norm (str or None, optional): If 'slaney', divide the triangular mel weights by the width of the mel band
(area normalization). (Default: ``None``) (area normalization). (Default: ``None``)
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``) mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
""" """
__constants__ = ['n_mels', 'sample_rate', 'f_min', 'f_max'] __constants__ = ['n_mels', 'sample_rate', 'f_min', 'f_max']
...@@ -399,7 +399,7 @@ class InverseMelScale(torch.nn.Module): ...@@ -399,7 +399,7 @@ class InverseMelScale(torch.nn.Module):
tolerance_loss (float, optional): Value of loss to stop optimization at. (Default: ``1e-5``) tolerance_loss (float, optional): Value of loss to stop optimization at. (Default: ``1e-5``)
tolerance_change (float, optional): Difference in losses to stop optimization at. (Default: ``1e-8``) tolerance_change (float, optional): Difference in losses to stop optimization at. (Default: ``1e-8``)
sgdargs (dict or None, optional): Arguments for the SGD optimizer. (Default: ``None``) sgdargs (dict or None, optional): Arguments for the SGD optimizer. (Default: ``None``)
norm (Optional[str]): If 'slaney', divide the triangular mel weights by the width of the mel band norm (str or None, optional): If 'slaney', divide the triangular mel weights by the width of the mel band
(area normalization). (Default: ``None``) (area normalization). (Default: ``None``)
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``) mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
""" """
...@@ -511,7 +511,7 @@ class MelSpectrogram(torch.nn.Module): ...@@ -511,7 +511,7 @@ class MelSpectrogram(torch.nn.Module):
:attr:`center` is ``True``. (Default: ``"reflect"``) :attr:`center` is ``True``. (Default: ``"reflect"``)
onesided (bool, optional): controls whether to return half of results to onesided (bool, optional): controls whether to return half of results to
avoid redundancy. (Default: ``True``) avoid redundancy. (Default: ``True``)
norm (Optional[str]): If 'slaney', divide the triangular mel weights by the width of the mel band norm (str or None, optional): If 'slaney', divide the triangular mel weights by the width of the mel band
(area normalization). (Default: ``None``) (area normalization). (Default: ``None``)
mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``) mel_scale (str, optional): Scale to use: ``htk`` or ``slaney``. (Default: ``htk``)
...@@ -821,7 +821,7 @@ class Resample(torch.nn.Module): ...@@ -821,7 +821,7 @@ class Resample(torch.nn.Module):
but less efficient. (Default: ``6``) but less efficient. (Default: ``6``)
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, optional): The shape parameter used for kaiser window.
dtype (torch.device, optional): dtype (torch.device, optional):
Determnines the precision that resampling kernel is pre-computed and cached. If not provided, Determnines the precision that resampling kernel is pre-computed and cached. If not provided,
kernel is computed with ``torch.float64`` then cached as ``torch.float32``. kernel is computed with ``torch.float64`` then cached as ``torch.float32``.
...@@ -921,8 +921,8 @@ class ComputeDeltas(torch.nn.Module): ...@@ -921,8 +921,8 @@ class ComputeDeltas(torch.nn.Module):
See `torchaudio.functional.compute_deltas` for more details. See `torchaudio.functional.compute_deltas` for more details.
Args: Args:
win_length (int): The window length used for computing delta. (Default: ``5``) win_length (int, optional): The window length used for computing delta. (Default: ``5``)
mode (str): Mode parameter passed to padding. (Default: ``'replicate'``) mode (str, optional): Mode parameter passed to padding. (Default: ``'replicate'``)
""" """
__constants__ = ['win_length'] __constants__ = ['win_length']
...@@ -1244,7 +1244,7 @@ class Vad(torch.nn.Module): ...@@ -1244,7 +1244,7 @@ class Vad(torch.nn.Module):
the detection algorithm (e.g. 0, 0.5, ...). (Default: 1.35) the detection algorithm (e.g. 0, 0.5, ...). (Default: 1.35)
measure_freq (float, optional) Frequency of the algorithm’s measure_freq (float, optional) Frequency of the algorithm’s
processing/measurements. (Default: 20.0) processing/measurements. (Default: 20.0)
measure_duration: (float, optional) Measurement duration. measure_duration: (float or None, optional) Measurement duration.
(Default: Twice the measurement period; i.e. with overlap.) (Default: Twice the measurement period; i.e. with overlap.)
measure_smooth_time (float, optional) Time constant used to smooth measure_smooth_time (float, optional) Time constant used to smooth
spectral measurements. (Default: 0.4) spectral measurements. (Default: 0.4)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment