Skip to content

Conversation

@co63oc
Copy link
Contributor

@co63oc co63oc commented May 26, 2025

PR Category

Execute Infrastructure

PR Types

Improvements

Description

blha_get_max_len 调用了max ,numpy中max不支持0-size,所以没有增加单测,只是修改kernel支持PaddleAPITest 测试运行
修改包含前向,没有反向
infermeta没有修改
kernel修改gpu/xpu,返回结果为一个整数保存在cpu后端中

numpy中max不支持0-size
image
PaddleAPITest 测试运行通过
image

mv 修改前向和反向
infermeta 不用修改
kernel 修改 cpu/gpu,前向共用impl实现
已修改测试用例, x末尾列需要和vec维度值相同,所以测试用例为
[0, 100], [100]
[100, 0], [0]
[0], [0]
PaddleAPITest 测试已修复cuda error, paddle, error, 错误为torch error
image

nanmedian 修改前向和反向
infermeta修改设置维度
修改cpu/gpu kernel
返回值需要Resize,Out返回NAN,median_index返回0

PaddleAPITest测试通过
image

@paddle-bot
Copy link

paddle-bot bot commented May 26, 2025

你的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 26, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label May 26, 2025
@DanielSun11
Copy link
Contributor

请增加下单测。不需要和np对比,只需要验证下0 size 作为输入时,输出的shape是否符合预期

@co63oc
Copy link
Contributor Author

co63oc commented May 26, 2025

请增加下单测。不需要和np对比,只需要验证下0 size 作为输入时,输出的shape是否符合预期

已修改

@luotao1
Copy link
Contributor

luotao1 commented May 28, 2025

@DanielSun11 可以review了

Copy link
Contributor

@DanielSun11 DanielSun11 left a comment

Choose a reason for hiding this comment

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

LGTM

@DanielSun11
Copy link
Contributor

@wanghuancoder 请留意下paddle/phi/kernels/fusion/gpu/blha_get_max_len.cu中所做的修改

@DanielSun11 DanielSun11 requested a review from wanghuancoder May 29, 2025 07:48
@co63oc co63oc changed the title [0-size Tensor No.81] Add 0-size Tensor support for blha_get_max_len [0-size Tensor No.81、138、141] Add 0-size Tensor support for blha_get_max_len Jun 1, 2025
@co63oc
Copy link
Contributor Author

co63oc commented Jun 2, 2025

CI不是修改代码错误

Copy link
Contributor

@wanghuancoder wanghuancoder left a comment

Choose a reason for hiding this comment

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

LGTM 请 @luotao1 协调云飞参与Review

median_index->set_dims(make_ddim(median_dim));

if (x.numel() == 0) {
out->set_dims(make_ddim({}));
Copy link
Contributor

Choose a reason for hiding this comment

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

维度为 {} 表示的是一个标量,这里用标量语义上是正确的吗?

Copy link
Contributor Author

@co63oc co63oc Jun 3, 2025

Choose a reason for hiding this comment

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

>>> import numpy as np >>> np.nanmedian(np.random.random([2,0])) nan >>> 

numpy测试是这样返回 @zyfncg

@luotao1 luotao1 merged commit 71ee897 into PaddlePaddle:develop Jun 4, 2025
47 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

5 participants