Skip to content

Conversation

@RedContritio
Copy link
Contributor

PR types

Bug fixes

PR changes

OPs

Describe

Solution

修改了错误的 output.shape 更新逻辑,使其支持长度为 0 的输入维度。

@paddle-bot-old paddle-bot-old bot added the contributor External developers label Jan 21, 2023
@luotao1 luotao1 mentioned this pull request Jan 22, 2023
Comment on lines +36 to +41
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]
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

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 的维度。

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

Copy link
Contributor

@JiabinYang JiabinYang 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 luotao1 merged commit 78ec942 into PaddlePaddle:develop Jan 31, 2023
pangengzheng pushed a commit to pangengzheng/Paddle that referenced this pull request Feb 2, 2023
@RedContritio RedContritio deleted the broadcast branch February 13, 2023 12:12
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.

4 participants