Skip to content

Commit 6da8c0c

Browse files
committed
optimize code
1 parent 62f3c7d commit 6da8c0c

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

python/paddle/audio/functional/window.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ def _apply_window_postprocess(
493493
raise RuntimeError(
494494
f"Pinning memory is not supported for {device}"
495495
)
496-
w = paddle.to_tensor(w, place=device)
496+
w = w.to(device=device)
497497
if pin_memory and paddle.in_dynamic_mode():
498498
w = w.pin_memory()
499499
if requires_grad is True:

test/legacy_test/test_window.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@
1818
from paddle.audio.functional.window import get_window
1919

2020

21-
def _has_cuda():
22-
return (
23-
paddle.is_compiled_with_cuda() and "gpu" in paddle.device.get_device()
24-
)
25-
26-
2721
class TestWindowFunctions(unittest.TestCase):
2822
def setUp(self):
2923
paddle.set_device("cpu")
@@ -67,7 +61,6 @@ def test_hamming_layout_warning(self):
6761
self.assertTrue(w.stop_gradient)
6862
self.assertEqual(list(w.shape), [N])
6963

70-
@unittest.skipUnless(_has_cuda(), "GPU not available")
7164
def test_hamming_device_gpu_pin_memory(self):
7265
if paddle.is_compiled_with_cuda():
7366
N = 12

0 commit comments

Comments
 (0)