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
5787787e
Unverified
Commit
5787787e
authored
Apr 26, 2018
by
Soumith Chintala
Committed by
GitHub
Apr 26, 2018
Browse files
fixes for 0.4 (#40)
parent
7236e3f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchaudio/transforms.py
torchaudio/transforms.py
+4
-4
No files found.
torchaudio/transforms.py
View file @
5787787e
...
...
@@ -213,7 +213,7 @@ class SPECTROGRAM(object):
assert
sig
.
dim
()
==
2
spec_f
=
torch
.
stft
(
sig
,
self
.
ws
,
self
.
hop
,
self
.
n_fft
,
True
,
self
.
window
,
self
.
pad
)
# (c, l, n_fft, 2)
True
,
True
,
self
.
window
,
self
.
pad
)
# (c, l, n_fft, 2)
spec_f
/=
self
.
window
.
pow
(
2
).
sum
().
sqrt
()
spec_f
=
spec_f
.
pow
(
2
).
sum
(
-
1
)
# get power of "complex" tensor (c, l, n_fft)
return
spec_f
if
is_variable
else
spec_f
.
data
...
...
@@ -250,9 +250,9 @@ class F2M(object):
fb
=
torch
.
zeros
(
n_fft
,
self
.
n_mels
)
for
m
in
range
(
1
,
self
.
n_mels
+
1
):
f_m_minus
=
bins
[
m
-
1
]
f_m
=
bins
[
m
]
f_m_plus
=
bins
[
m
+
1
]
f_m_minus
=
bins
[
m
-
1
]
.
item
()
f_m
=
bins
[
m
]
.
item
()
f_m_plus
=
bins
[
m
+
1
]
.
item
()
if
f_m_minus
!=
f_m
:
fb
[
f_m_minus
:
f_m
,
m
-
1
]
=
(
torch
.
arange
(
f_m_minus
,
f_m
)
-
f_m_minus
)
/
(
f_m
-
f_m_minus
)
...
...
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