You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x=paddle.rand([2, 1, 0])
x=paddle.reshape(x, [0])
print(x)
# ValueError: (InvalidArgument) The 'shape' in ReshapeOp is invalid. The input tensor X'size must be equal to the capacity # of 'shape'. But received X's shape = [2, 1, 0], X's size = 0, 'shape' is [0], the capacity of 'shape' is 2.# [Hint: Expected capacity == in_size, but received capacity:2 != in_size:0.] (at ..\paddle\phi\infermeta\unary.cc:1967)
你的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.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
User Experience
PR Types
Bug fixes
Description
本 pr 是修复 【Hackathon 6th No.9】Add cartesian_prod API to Paddle -part #65605 (comment) 出现的问题:静态图下
paddle.reshape 的输入如果是 zero-size tensor,结果返回的是 None。
修改前:
修改后:
本 pr 把之前对 infermeta/unary.cc 中 ValidateShape 的修改迁移到了 fluid/operator/reshape_op.cc 的 ValidateShape 中,
之前的修改是:【Hackathon 6th No.9】Update ValidateShape to support zero sized tensor flatten -part #64715 ,相比当时修改之前增加支持的 case 是:当输入是
zero-size tensor,且 output_shape 中 0 出现的位置小于 in_dims.size(),例如:
修改前:
修改后: