-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Fix 空指针 (Null pointer) of case15: paddle.broadcast_tensors #49980
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
Conversation
| output_shape = [1 for i in range(output_rank)] | ||
| for i in range(output_rank): | ||
| for x in input_list: | ||
| shape = list(reversed(x.shape)) | ||
| size = 1 | ||
| if i < len(shape): | ||
| size = shape[i] | ||
| output_shape[i] = max(output_shape[i], size) | ||
| if i < len(shape) and shape[i] != 1: | ||
| output_shape[i] = shape[i] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要修改这个单测呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果不修改的话,默认的方法不支持含有 dim = 0 的数组。
因为原有 max 取 dim 和 size = 1 时,会忽略 dim == 0 的维度。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…dle#49980) * fix incorrect output shape of broadcast * add unittest
PR types
Bug fixes
PR changes
OPs
Describe
Solution
修改了错误的
output.shape更新逻辑,使其支持长度为 0 的输入维度。