Skip to content
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

[PIR] change FullWithTensor input shape to mutable attribute #63332

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Apr 8, 2024

PR Category

Execute Infrastructure

PR Types

Bug fixes

Description

FullWithTensor 的输入 shape 修改为可变 attribute,以使其可以包含 ParseValueShape 以从输入 shape 解析出来 Full

with paddle.pir_utils.IrGuard():
    x = paddle.static.data("x", shape=[], dtype='int32')
    out = paddle.zeros(shape=[101, x])
    print(out.shape) # 应为 [101, -1],但是实际为 [-1, -1]

我们目前只有对 IntArray 才会在 InferMeta 时生成 ParseValueShape,才会从 [101, Value()] 这种 case 中正确解析出 shape,但 FullWithTensor 的输入 shape 是 Tensor,也就没有这个解析操作,InferMeta 后 shape 就变成了 [-1, -1],但实际上 [101, -1] 才是合理的

Full 的 shape 是完全静态化的,不支持可变 attribute,因此这种情况是不能转成 Full 的,而将 FullWithTensorshape 变成可变 attribute 后,只是功能的扩展,是兼容之前的情况的,只是输入顺序修改了下,value 需要在 shape 之前

cc @HydrogenSulfate

PCard-66972

Copy link

paddle-bot bot commented Apr 8, 2024

你的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.

@SigureMo SigureMo changed the title [Dy2St] Mark FullWithTensor shape as mutable attribute [Dy2St] change FullWithTensor input shape to mutable attribute Apr 9, 2024
@SigureMo SigureMo changed the title [Dy2St] change FullWithTensor input shape to mutable attribute [Dy2St] change FullWithTensor input shape to mutable attribute Apr 9, 2024
wanghuancoder
wanghuancoder previously approved these changes Apr 10, 2024
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

- op : full_with_tensor
int_array:
shape :
data_type : int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里可以使用int64吗?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我改一下~

SigureMo added a commit to cattidea/Paddle that referenced this pull request Apr 10, 2024
@SigureMo SigureMo changed the title [Dy2St] change FullWithTensor input shape to mutable attribute [PIR] change FullWithTensor input shape to mutable attribute Apr 10, 2024
@SigureMo SigureMo merged commit dfc7fae into PaddlePaddle:develop Apr 10, 2024
28 of 30 checks passed
@SigureMo SigureMo deleted the pir/mark-full-with-tensor-shape-as-mutable-attr branch April 10, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants