Unverified Commit 805d7922 authored by Vincent QB's avatar Vincent QB Committed by GitHub
Browse files

create tensor directly on device. (#377)

parent 9409824f
......@@ -152,8 +152,7 @@ def istft(
assert 0 < win_length <= n_fft
if window is None:
window = torch.ones(win_length)
window.to(device=device, dtype=dtype)
window = torch.ones(win_length, device=device, dtype=dtype)
assert window.dim() == 1 and window.size(0) == win_length
......@@ -176,8 +175,7 @@ def istft(
# 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)
eye = torch.eye(n_fft)
eye = eye.to(device=device, dtype=dtype).unsqueeze(1) # size (n_fft, 1, n_fft)
eye = torch.eye(n_fft, 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
# ytmp is added starting at i*hop_length in the output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment