CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[0-size Tensor No.343, 350, 351] Add 0-size Tensor support for paddle.tril paddle.Tensor.tril paddle.triu API. #72814
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
[0-size Tensor No.343, 350, 351] Add 0-size Tensor support for paddle.tril paddle.Tensor.tril paddle.triu API. #72814
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
遇到了clone过程超时的问题导致必要的check不通过。求助,我应该如何修改。 |
非常感谢@DanielSun11 指出的问题 |
PaddleAPITest可能最近重新整理了下目录 另外,请一并报名任务 343 |
@DanielSun11已经报名任务 343 paddle.Tensor.tril。 |
👍 ACK |
非常感谢,前向测试改为直接使用test_check_output测试。主要是启航计划本周结营,所以想赶一赶进度,在本周日前完成。 |
请重新构建一下:PR-CI-Hygon-DCU-Test |
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
out_gpu = paddle.triu(x_gpu) | ||
assert out_gpu.shape == x_gpu.shape | ||
|
||
def test_0size_api_with_backward(): |
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.
改成 def test_0size_api_with_backward(self) :?
@@ -326,6 +326,52 @@ def test_base_api(self): | |||
fetch_list=[triu_out], | |||
) | |||
|
|||
def test_0size_api(): |
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.
def test_0size_api(self):
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.
def test_0size_api(self):
是的,在之前的版本中,这个单测代码需要修改,当时也发现了这个问题。但目前根据@fangfangssj的建议,‘前向测试可以直接使用test_check_output来测试,不需要写一个新的’,我就重写了单测部分,旧的版本已经删除了。
已重新构建 |
@DanielSun11 还有16个check未完成。其中是否有需要您approve才能进行的。 |
@DanielSun11 所有check均已完成。 |
有两个Required CI出现了异常,似乎不是代码改动的关系。请稍后在本PR中添加评论 重新运行下失败的CI。 |
/re-run all-failed |
2 similar comments
/re-run all-failed |
/re-run all-failed |
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
请补充下paddleAPITest的回测结果,然后等待 @wanghuancoder review&merge |
这里是paddleAPITest的回测结果 |
这里是回测结果文件 |
好的,已补充回测结果。 |
@wanghuancoder 已完成 paddle.tril、paddle.Tensor.tril 和 paddle.triu 对 0-Size 张量的支持,PR已就绪,等待您的代码评审与合并。 |
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.
paddle/phi/kernels/xpu/tril_triu_kernel.cc
paddle/phi/kernels/xpu/tril_triu_grad_kernel.cc
这两个也得修复一下
@wanghuancoder 已修复文件 |
/re-run all-failed |
1 similar comment
/re-run all-failed |
@wanghuancoder 已通过所有check,等待您的审核通过。 |
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
hi, @crashbussy
|
PR Category
Execute Infrastructure
PR Types
New features
Description
paddle.tril paddle.Tensor.tril paddle.triu支持0-Size。
修改历程介绍如下:
本次 PR 旨在补充
paddle.tril
和paddle.triu
在 XPU 上对 0-size tensor 的适配。具体修改如下:paddle.tril
和paddle.triu
的错误日志,未发现报错(注意!这个理解是错误的,因为PaddleAPITest可能最近重新整理了下目录,在下面的comment中可以看到解释);代码检查:
查阅以下 kernel 实现文件:
paddle/phi/kernels/xpu/tril_triu_kernel.cc
paddle/phi/kernels/xpu/tril_triu_grad_kernel.cc
paddle/phi/kernels/tril_triu_kernel.h
paddle/phi/kernels/tril_triu_grad_kernel.h
发现无需修改代码逻辑。(注意!这个理解是错误的,在后面的comment中有解释。仍然需要修改kernel)
最新的原因说明:

根据DanielSun11的提示。PaddleAPITest 有报错信息。日志所在的路径:
PaddleAPITest/report/0size_tensor_gpu/20250319/compare_with_torch/coredump_error/error_log.log
paddle/phi/kernels/impl/tril_triu_kernel_impl.h 中TriuKernel TrilKernel 并无法很好的支持0 size Tensor。当遇到0 size Tensor时没及时返回导致GPU版本的实现中launch了cuda kernel,进而出现cuda error 9 这个报错。
添加单测:
在test/legacy_test/test_tril_triu_op.py中添加0 size tensor输入的单测(在原有基础上新增了0size的情况):
回测结果

api_config_pass.txt log.log 这里是全部回测log
https://github.com/PFCCLab/PaddleAPITest/tree/main/report/0size_tensor_gpu/20250319
我从这个地址进入,并没有在20250319文件夹中找到compare_with_torch文件夹。因此在搜索报错时并没有发现有报错信息。DanielSun11提供了一个日志的路径PaddleAPITest/report/0size_tensor_gpu/20250319/compare_with_torch/coredump_error/error_log.log,但似乎我在PaddleAPITest中找不到这个文件,根据DanielSun11的回答, PaddleAPITest可能最近重新整理了下目录,所以从第一个地址进入是没有这个文件的。
Pcard-67164