Skip to content

[0-size Tensor No.100] Add 0-size Tensor support for ldexp - #73002

Closed
enkilee wants to merge 1 commit into
PaddlePaddle:developfrom
enkilee:0size-100-ldexp
Closed

enkilee wants to merge 1 commit into
PaddlePaddle:developfrom
enkilee:0size-100-ldexp

Conversation

@enkilee

@enkilee enkilee commented May 29, 2025 •

Copy link
Copy Markdown
Collaborator

PR Category

Execute Infrastructure

PR Types

Improvements

Description

在 PaddleAPITest中,运行报错。
但是用代码直接运行,是可以的。
如下:

import paddle

paddle.device.set_device("gpu")
x = paddle.to_tensor(0, dtype='float32')
y = paddle.to_tensor(0, dtype='int32')
res = paddle.ldexp(x, y)
print(res)

结果:

W0529 03:50:15.910976 10840 gpu_resources.cc:114] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
Tensor(shape=[], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       0.)
import paddle

paddle.device.set_device("gpu")
x = paddle.to_tensor([0], dtype='float32')
y = paddle.to_tensor([0], dtype='int32')
res = paddle.ldexp(x, y)
print(res)

结果:

W0529 03:56:33.115897 12246 gpu_resources.cc:114] Please NOTE: device: 0, GPU Compute Capability: 7.0, Driver API Version: 12.0, Runtime API Version: 11.8
Tensor(shape=[1], dtype=float32, place=Place(gpu:0), stop_gradient=True,
       [0.])

故添加单测。

@paddle-bot

paddle-bot Bot commented May 29, 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 29, 2025
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label May 29, 2025
@DanielSun11

Copy link
Copy Markdown
Contributor

PaddleAPITest报错说明仍然存在错误。

import paddle

paddle.device.set_device("gpu")
x = paddle.to_tensor(0, dtype='float32')
y = paddle.to_tensor(0, dtype='int32')
res = paddle.ldexp(x, y)
print(res)
import paddle

paddle.device.set_device("gpu")
x = paddle.to_tensor([0], dtype='float32')
y = paddle.to_tensor([0], dtype='int32')
res = paddle.ldexp(x, y)
print(res)

这两个测试都不是0-size Tensor建议尝试

np_x = np.ones([3,0])
x = paddle.to_tensor(np_x)

构造0 size Tensor。问题尚未解决,请尝试修改

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

问题尚未解决

@enkilee

enkilee commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator Author

恩,原因是在pow这里,pow有问题。

@paddle-ci-bot

paddle-ci-bot Bot commented Jun 6, 2025

Copy link
Copy Markdown

Sorry to inform you that 40ba4a0's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

@luotao1

luotao1 commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

@enkilee 敏师傅,要不要更新下

@luotao1

luotao1 commented Jun 10, 2025

Copy link
Copy Markdown
Collaborator

恩,原因是在pow这里,pow有问题。

可能等下面PR合入后,可以merge下develop

@luotao1

luotao1 commented Jun 11, 2025

Copy link
Copy Markdown
Collaborator

敏师傅,pow的PR合入了,可以再更新试试

@enkilee

enkilee commented Jun 16, 2025

Copy link
Copy Markdown
Collaborator Author

敏师傅,pow的PR合入了,可以再更新试试

co63co师傅做好了ldexp了,我把PR关了。

@enkilee enkilee closed this Jun 16, 2025
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