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
805d7922
"tests/vscode:/vscode.git/clone" did not exist on "f81a60bec0e31e5c6c219d0566ecb4ae45ea1588"
Unverified
Commit
805d7922
authored
Dec 26, 2019
by
Vincent QB
Committed by
GitHub
Dec 26, 2019
Browse files
create tensor directly on device. (#377)
parent
9409824f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
torchaudio/functional.py
torchaudio/functional.py
+2
-4
No files found.
torchaudio/functional.py
View file @
805d7922
...
@@ -152,8 +152,7 @@ def istft(
...
@@ -152,8 +152,7 @@ def istft(
assert
0
<
win_length
<=
n_fft
assert
0
<
win_length
<=
n_fft
if
window
is
None
:
if
window
is
None
:
window
=
torch
.
ones
(
win_length
)
window
=
torch
.
ones
(
win_length
,
device
=
device
,
dtype
=
dtype
)
window
.
to
(
device
=
device
,
dtype
=
dtype
)
assert
window
.
dim
()
==
1
and
window
.
size
(
0
)
==
win_length
assert
window
.
dim
()
==
1
and
window
.
size
(
0
)
==
win_length
...
@@ -176,8 +175,7 @@ def istft(
...
@@ -176,8 +175,7 @@ def istft(
# each column of a channel is a frame which needs to be overlap added at the right place
# each column of a channel is a frame which needs to be overlap added at the right place
ytmp
=
ytmp
.
transpose
(
1
,
2
)
# size (channel, n_fft, n_frame)
ytmp
=
ytmp
.
transpose
(
1
,
2
)
# size (channel, n_fft, n_frame)
eye
=
torch
.
eye
(
n_fft
)
eye
=
torch
.
eye
(
n_fft
,
device
=
device
,
dtype
=
dtype
).
unsqueeze
(
1
)
# size (n_fft, 1, n_fft)
eye
=
eye
.
to
(
device
=
device
,
dtype
=
dtype
).
unsqueeze
(
1
)
# size (n_fft, 1, n_fft)
# this does overlap add where the frames of ytmp are added such that the i'th frame of
# this does overlap add where the frames of ytmp are added such that the i'th frame of
# ytmp is added starting at i*hop_length in the output
# ytmp is added starting at i*hop_length in the output
...
...
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