Commit ec0b29f5 authored by Jason Lian's avatar Jason Lian
Browse files

update doc

parent 1059c7ca
...@@ -18,6 +18,7 @@ __all__ = [ ...@@ -18,6 +18,7 @@ __all__ = [
'mu_law_expanding' 'mu_law_expanding'
] ]
def scale(tensor, factor): def scale(tensor, factor):
# type: (Tensor, int) -> Tensor # type: (Tensor, int) -> Tensor
"""Scale audio tensor from a 16-bit integer (represented as a FloatTensor) """Scale audio tensor from a 16-bit integer (represented as a FloatTensor)
...@@ -26,10 +27,10 @@ def scale(tensor, factor): ...@@ -26,10 +27,10 @@ def scale(tensor, factor):
Inputs: Inputs:
tensor (Tensor): Tensor of audio of size (Samples x Channels) tensor (Tensor): Tensor of audio of size (Samples x Channels)
factor (int): Maximum value of input tensor. default: 16-bit depth factor (int): Maximum value of input tensor
Outputs: Outputs:
Tensor: Scaled by the scale factor. (default between -1.0 and 1.0) Tensor: Scaled by the scale factor
""" """
if not tensor.dtype.is_floating_point: if not tensor.dtype.is_floating_point:
tensor = tensor.to(torch.float32) tensor = tensor.to(torch.float32)
...@@ -51,8 +52,6 @@ def pad_trim(tensor, ch_dim, max_len, len_dim, fill_value): ...@@ -51,8 +52,6 @@ def pad_trim(tensor, ch_dim, max_len, len_dim, fill_value):
Outputs: Outputs:
Tensor: Padded/trimmed tensor Tensor: Padded/trimmed tensor
""" """
assert tensor.size(ch_dim) < 128, \
"Too many channels ({}) detected, see channels_first param.".format(tensor.size(ch_dim))
if max_len > tensor.size(len_dim): if max_len > tensor.size(len_dim):
# tuple of (padding_left, padding_right, padding_top, padding_bottom) # tuple of (padding_left, padding_right, padding_top, padding_bottom)
# so pad similar to append (aka only right/bottom) and do not pad # so pad similar to append (aka only right/bottom) and do not pad
...@@ -109,7 +108,7 @@ def spectrogram(sig, pad, window, n_fft, hop, ws, power, normalize): ...@@ -109,7 +108,7 @@ def spectrogram(sig, pad, window, n_fft, hop, ws, power, normalize):
window (Tensor): window_tensor window (Tensor): window_tensor
n_fft (int): size of fft n_fft (int): size of fft
hop (int): length of hop between STFT windows hop (int): length of hop between STFT windows
ws (int): window size. default: n_fft ws (int): window size
power (int > 0 ) : Exponent for the magnitude spectrogram, power (int > 0 ) : Exponent for the magnitude spectrogram,
e.g., 1 for energy, 2 for power, etc. e.g., 1 for energy, 2 for power, etc.
normalize (bool) : whether to normalize by magnitude after stft normalize (bool) : whether to normalize by magnitude after stft
......
...@@ -4,6 +4,7 @@ import torch ...@@ -4,6 +4,7 @@ import torch
import numpy as np import numpy as np
from . import functional as F from . import functional as F
class Compose(object): class Compose(object):
"""Composes several transforms together. """Composes several transforms together.
......
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