Skip to content

Commit

Permalink
change to import numpy as np (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
JackTemaki authored Oct 20, 2023
1 parent 48ade42 commit 8ee4ee0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/test_feature_extraction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import copy
import numpy
import numpy as np
import torch

from librosa.feature import melspectrogram
Expand All @@ -9,7 +9,7 @@

def test_logmel_librosa_compatibility():

audio = numpy.asarray(numpy.random.random((50000)), dtype=numpy.float32)
audio = np.asarray(np.random.random((50000)), dtype=np.float32)
librosa_mel = melspectrogram(
y=audio,
sr=16000,
Expand All @@ -20,7 +20,7 @@ def test_logmel_librosa_compatibility():
fmax=7600,
n_mels=80,
)
librosa_log_mel = numpy.log10(numpy.maximum(librosa_mel, 1e-10))
librosa_log_mel = np.log10(np.maximum(librosa_mel, 1e-10))

fe_cfg = LogMelFeatureExtractionV1Config(
sample_rate=16000,
Expand Down Expand Up @@ -56,8 +56,8 @@ def test_logmel_length():
fe_no_center_cfg.center = False
fe_no_center = LogMelFeatureExtractionV1(cfg=fe_no_center_cfg)
for i in range(10):
audio_length = int(numpy.random.randint(10000, 50000))
audio = numpy.asarray(numpy.random.random(audio_length), dtype=numpy.float32)
audio_length = int(np.random.randint(10000, 50000))
audio = np.asarray(np.random.random(audio_length), dtype=np.float32)
audio_length = torch.tensor(int(audio_length))
audio_length = torch.unsqueeze(audio_length, 0)
audio = torch.unsqueeze(torch.tensor(audio), 0)
Expand Down

0 comments on commit 8ee4ee0

Please sign in to comment.