Skip to content

[0-size Tensor No.101、311] Add 0-size Tensor support for lerp - #72906

Merged
wanghuancoder merged 8 commits into
PaddlePaddle:developfrom
co63oc:b15
May 28, 2025
Merged

wanghuancoder merged 8 commits into
PaddlePaddle:developfrom
co63oc:b15

Conversation

@co63oc

@co63oc co63oc commented May 23, 2025 •

Copy link
Copy Markdown
Contributor

PR Category

Execute Infrastructure

PR Types

Improvements

Description

lerp修改前向和反向,去掉判断 numel 为0的异常信息
infermeta 不用修改
kernel 修改cpu/gpu

PaddleAPITest 测试paddle error和cuda error已通过,错误为torch error,torch没有支持0-size
image

@paddle-bot

paddle-bot Bot commented May 23, 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.

@paddle-bot paddle-bot Bot added the contributor External developers label May 23, 2025
@co63oc co63oc changed the title CI测试不review [0-size Tensor No.101、311] Add 0-size Tensor support for lerp May 24, 2025
@co63oc

co63oc commented May 24, 2025

Copy link
Copy Markdown
Contributor Author

image
CI / Api-Benchmark, CI / PR-CI-Inference 不知道怎么重新运行

@DanielSun11
DanielSun11 self-requested a review May 25, 2025 15:04
@DanielSun11 DanielSun11 self-assigned this May 25, 2025
@DanielSun11 DanielSun11 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label May 25, 2025
} else {
phi::Full<T, Context>(
ctx, phi::IntArray(common::vectorize(x_grad->dims())), 0, x_grad);
}

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.

逻辑感觉不太对。应该是:

if (x_grad) {
     ctx.template Alloc<T>(x_grad);
      if (x_grad->numel() != 0) {
               phi::Full<T, Context>(
            ctx, phi::IntArray(common::vectorize(x_grad->dims())), 0, x_grad);
      } 

 }

非0 size 的Tensor需要先分配空间再初始化

@co63oc co63oc May 26, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

phi::Full 调用的是FullKernel,也有分配空间的代码
image

简化为 phi::Full,
phi::Full 调用FullKernel 已经有numel = 0的判断

@DanielSun11

Copy link
Copy Markdown
Contributor

请merge下最新的develop分支

@luotao1

luotao1 commented May 27, 2025

Copy link
Copy Markdown
Collaborator

@DanielSun11 可以review了

@DanielSun11 DanielSun11 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 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants