Skip to content

Implement paddle.min/paddle.max for 0-size tensors along non-zero dimensions #72565

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

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

aquagull
Copy link
Contributor

@aquagull aquagull commented Apr 30, 2025

PR Category

User Experience

PR Types

Others

Description

为paddle.max、paddle.min支持 指定axis为非零轴的0-size tensor输入。
以numpy为例

data = np.random.random([0, 2, 3])
res = np.max(data, axis)
  1. axis = (0, )
ValueError: zero-size array to reduction operation maximum which has no identity
  1. 指定 axis = (1, ), keepdims = False
shape:(0, 3), val: []
  1. 指定 axis = (2, ), keepdims = False
shape:(0, 2), val: []
  1. 指定 axis = (1, 2), keepdims = False
shape:(0,), val: []
  1. 指定axis = (2, ), keepdims = True
shape:(0, 2, 1), val: []
  1. 指定axis = (1, ), keepdims = True
shape:(0, 1, 3), val: []

Copy link

paddle-bot bot commented Apr 30, 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 Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant