-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[API compatibility] support windows api #76237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API compatibility] support windows api #76237
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
|
./re-run all-failed |
… align_window_func_with_torch
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #76237 +/- ##
==========================================
Coverage ? 90.00%
==========================================
Files ? 2
Lines ? 40
Branches ? 0
==========================================
Hits ? 36
Misses ? 4
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/re-run all-failed |
|
/re-run all-failed |
|
中文文档Pr链接:PaddlePaddle/docs#7631 |
|
/re-run all-failed |
… align_window_func_with_torch
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
竞品支持的参数,除了layout、memory_format,其他都需要支持。
| warnings.warn("layout only supports 'strided' in Paddle; ignored") | ||
|
|
||
| # device: accept PlaceLike strings like 'cpu', 'gpu:0', 'cuda:0' | ||
| if device is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个你可以直接调 _get_paddle_place
参考下paddle.full、random是如何处理这几个参数的,可以复制过来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
|
已经都支持了,您看一下
---- Replied Message ----
| From | ***@***.***> |
| Date | 11/17/2025 16:16 |
| To | PaddlePaddle/Paddle ***@***.***> |
| Cc | Tianyu ***@***.***>,
Author ***@***.***> |
| Subject | Re: [PaddlePaddle/Paddle] [API compatibility] support windows api (PR #76237) |
@zhwesky2010 commented on this pull request.
竞品支持的参数,除了layout、memory_format,其他都需要支持。
In python/paddle/audio/functional/window.py:
@@ -445,3 +446,266 @@ def get_window(
params = (win_length, *args)
kwargs = {'sym': sym}
return winfunc(*params, dtype=dtype, **kwargs)
+
+
+def _apply_window_postprocess(
+ w: Tensor,
+ *,
+ layout: str | None = None,
+ device: str | None = None,
+ pin_memory: None | bool,
+ requires_grad: None | bool,
+) -> Tensor:
+ if layout is not None:
+ warnings.warn("layout only supports 'strided' in Paddle; ignored")
+
+ # device: accept PlaceLike strings like 'cpu', 'gpu:0', 'cuda:0'
+ if device is not None:
这个你可以直接调 _get_paddle_place
参考下paddle.full、random是如何处理这几个参数的,可以复制过来
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
| @@ -0,0 +1,179 @@ | |||
| # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个命名改一下:test_window.py
|
@zty-king 没看到提交呢,没有git push吗 |
… align_window_func_with_torch
昨天有点别的工作处理,已经修改,您看一下 |
test/legacy_test/CMakeLists.txt
Outdated
| set_tests_properties(test_legacy_loss_args PROPERTIES TIMEOUT 10) | ||
| set_tests_properties(test_activation_nn_grad PROPERTIES TIMEOUT 250) | ||
| set_tests_properties(test_empty_op PROPERTIES TIMEOUT 120) | ||
| set_tests_properties(test_window PROPERTIES TIMEOUT 10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方能不要改不,会触发需要额外的approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,已经去掉了
| warnings.warn("layout only supports 'strided' in Paddle; ignored") | ||
|
|
||
| if in_dynamic_or_pir_mode(): | ||
| device = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
你这后面没有对device做处理呢,paddle.full的kernel可以直接传递一个device,而这个并没有处理device。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
抱歉漏掉了,已更正
|
/re-run all-failed |
| raise RuntimeError( | ||
| f"Pinning memory is not supported for {device}" | ||
| ) | ||
| w = paddle.to_tensor(w, place=device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用Tensor.to是不是好点?
| ) | ||
| w = paddle.to_tensor(w, place=device) | ||
| if pin_memory and paddle.in_dynamic_mode(): | ||
| w = w.pin_memory() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里还需要吗,上面已经设置了pinnedplace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@unittest.skipIf. 是否是必要的,触发了CI拦截 |
这个确实需要,因为在纯CPU环境下,那个包含device为gpu的测试会报错,所以需要在纯CPU环境下需要跳过这条测试 |
|
|
||
| @unittest.skipUnless(_has_cuda(), "GPU not available") | ||
| def test_hamming_device_gpu_pin_memory(self): | ||
| if paddle.is_compiled_with_cuda(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不是有判断吗,为什么单测还会报错。这个case改下吧。不支持的不用加。尽量不要skipif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,之前好像是在哪被CI拦截了,我再尝试一下
|
/re-run all-failed |
1 similar comment
|
/re-run all-failed |
zhwesky2010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@zty-king 这个返回结果与torch不一致,无法通过PaConvert的测试: |
Done. |

PR Category
User Experience
PR Types
Others
Description
-以下是window函数与参数暴露情况的对应关系,同时加入了get_window进行对比: