pull/1528/head
KP 3 years ago
parent 25cb4bb06a
commit 504c2c9d50

@ -11,5 +11,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from . import compliance
from . import datasets
from . import features
from . import functional
from . import io
from . import metric
from . import sox_effects
from .backends import load from .backends import load
from .backends import save from .backends import save

@ -71,15 +71,17 @@ class Spectrogram(nn.Layer):
if win_length is None: if win_length is None:
win_length = n_fft win_length = n_fft
fft_window = get_window(window, win_length, fftbins=True, dtype=dtype) self.fft_window = get_window(
window, win_length, fftbins=True, dtype=dtype)
self._stft = partial( self._stft = partial(
paddle.signal.stft, paddle.signal.stft,
n_fft=n_fft, n_fft=n_fft,
hop_length=hop_length, hop_length=hop_length,
win_length=win_length, win_length=win_length,
window=fft_window, window=self.fft_window,
center=center, center=center,
pad_mode=pad_mode) pad_mode=pad_mode)
self.register_buffer('fft_window', self.fft_window)
def forward(self, x): def forward(self, x):
stft = self._stft(x) stft = self._stft(x)

Loading…
Cancel
Save