Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
cf6ce7dc
"server/vscode:/vscode.git/clone" did not exist on "0f346a3296486deb79c63f778b9fc4d9107e4a23"
Commit
cf6ce7dc
authored
Jul 10, 2019
by
jamarshon
Committed by
cpuhrsch
Jul 10, 2019
Browse files
CI build fix (#132)
parent
bd00146d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
test/test_transforms.py
test/test_transforms.py
+6
-4
No files found.
test/test_transforms.py
View file @
cf6ce7dc
...
...
@@ -230,10 +230,10 @@ class Tester(unittest.TestCase):
librosa_mel
=
librosa
.
feature
.
melspectrogram
(
y
=
sound_librosa
,
sr
=
sample_rate
,
n_fft
=
n_fft
,
hop_length
=
hop_length
,
n_mels
=
n_mels
,
htk
=
True
,
norm
=
None
)
librosa_mel_tensor
=
torch
.
from_numpy
(
librosa_mel
)
torch_mel
=
melspect_transform
(
sound
).
squeeze
().
cpu
().
t
()
# lower tolerance, think it's double vs. float
self
.
assertTrue
(
torch
.
allclose
(
torch_mel
.
type
(
torch
.
double
),
torch
.
from_numpy
(
librosa_mel
),
atol
=
5e-3
))
self
.
assertTrue
(
torch
.
allclose
(
torch_mel
.
type
(
librosa_mel_tensor
.
dtype
),
librosa_mel_tensor
,
atol
=
5e-3
))
# test s2db
...
...
@@ -244,8 +244,9 @@ class Tester(unittest.TestCase):
db_torch
=
db_transform
(
melspect_transform
(
sound
)).
squeeze
().
cpu
().
t
()
db_librosa
=
librosa
.
core
.
spectrum
.
power_to_db
(
librosa_mel
)
db_librosa_tensor
=
torch
.
from_numpy
(
db_librosa
)
self
.
assertTrue
(
torch
.
allclose
(
db_torch
.
type
(
torch
.
double
),
torch
.
from_numpy
(
db_librosa
)
,
atol
=
5e-3
))
self
.
assertTrue
(
torch
.
allclose
(
db_torch
.
type
(
db_librosa_tensor
.
dtype
),
db_librosa
_tensor
,
atol
=
5e-3
))
# test MFCC
melkwargs
=
{
'hop'
:
hop_length
,
'n_fft'
:
n_fft
}
...
...
@@ -269,9 +270,10 @@ class Tester(unittest.TestCase):
# n_mels=n_mels)
librosa_mfcc
=
scipy
.
fftpack
.
dct
(
db_librosa
,
axis
=
0
,
type
=
2
,
norm
=
'ortho'
)[:
n_mfcc
]
librosa_mfcc_tensor
=
torch
.
from_numpy
(
librosa_mfcc
)
torch_mfcc
=
mfcc_transform
(
sound
).
squeeze
().
cpu
().
t
()
self
.
assertTrue
(
torch
.
allclose
(
torch_mfcc
.
type
(
torch
.
double
),
torch
.
from_numpy
(
librosa_mfcc
)
,
atol
=
5e-3
))
self
.
assertTrue
(
torch
.
allclose
(
torch_mfcc
.
type
(
librosa_mfcc_tensor
.
dtype
),
librosa_mfcc
_tensor
,
atol
=
5e-3
))
kwargs1
=
{
'n_fft'
:
400
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment