Skip to content

Commit

Permalink
add docstring, test=asr
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackwaterveg committed Mar 29, 2022
1 parent ed490b6 commit f47146a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions paddlespeech/s2t/transform/spectrogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,20 @@ def __repr__(self):
dither=self.dither, ))

def __call__(self, x, train):
"""
Args:
x (np.ndarray): shape (Ti,)
train (bool): True, train mode.
Raises:
ValueError: not support (Ti, C)
Returns:
np.ndarray: (T, D)
"""
dither = self.dither if train else 0.0
if x.ndim != 1:
raise ValueError("Not support x: [Time, Channel]")
waveform = paddle.to_tensor(np.expand_dims(x, 0), dtype=paddle.float32)
mat = kaldi.fbank(
waveform,
Expand Down

0 comments on commit f47146a

Please sign in to comment.