Skip to content

[0-size Tensor No.38] Add 0-size Tensor support for paddle.cross API - #72764

Merged
wanghuancoder merged 6 commits into
PaddlePaddle:developfrom
DanielSun11:fix_0-size_cross
May 21, 2025
Merged

wanghuancoder merged 6 commits into
PaddlePaddle:developfrom
DanielSun11:fix_0-size_cross

Conversation

@DanielSun11

@DanielSun11 DanielSun11 commented May 16, 2025 •

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Improvements

Description

修复paddle.cross不支持0 size Tensor的问题。
问题描述:
PaddleAPITest的报错信息如下:
image
多个case报cuda error 9。大概率是遇到0 size Tensor没有及时return的原因。

解决过程:

  1. 检查CrossInferMeta,没有发现问题。
  2. 检查前向kernel(CrossKernel)该kernel在 【HEU】[Paddle Tensor 第二期 API支持 0-size Tensor] paddle.cross 支持 0-size tensor  #70103 中已经被修复。
  3. 检查并修复反向kernel CrossGradKernel
  4. 只找到cpu 和 gpu存在对应的kernel 暂时未发现其他设备存在这个kernel
  5. 添加单测
  6. PaddleAPITest回测,回测结果:
    94a3f349cf2b141f804e987b750350f4

Pcard-67164

@paddle-bot

paddle-bot Bot commented May 16, 2025

Copy link
Copy Markdown

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册。
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@wanghuancoder wanghuancoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder
wanghuancoder merged commit 16465cf into PaddlePaddle:develop May 21, 2025
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 22, 2025
…addlePaddle#72764)

* [0 size Tensor]Fix CrossGradKernel

* add  test case

* add cpu unittest case

* Update cross_grad_kernel.cu

* format
@DanielSun11
DanielSun11 deleted the fix_0-size_cross branch September 18, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants