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

[Prim] Filter tensor type for int_array and scalar input in composite rule #51208

Merged
merged 5 commits into from
Mar 14, 2023

Conversation

cyber-pioneer
Copy link
Contributor

@cyber-pioneer cyber-pioneer commented Mar 5, 2023

PR types

Bug fixes

PR changes

Others

Describe

Tensor type for int_array and scalar input will cause dynamic shape in static mode, but composite rule does not support currently.

As for arg "shape" of int_array type. It may be one of [list/tuple of int, tensor]. The former is widely used actually, while the latter is rarely used and will cause dynamic shape in static mode which needs extra unnecessary process. Thus, it would be better to filter it in composite rules.

@paddle-bot
Copy link

paddle-bot bot commented Mar 5, 2023

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

@JiabinYang
Copy link
Contributor

PR types

Bug fixes

PR changes

Others

Describe

Tensor type for int_array and scalar input is legacy type. And it will be removed in the future.

As for arg "shape" of int_array type. It may be one of [list/tuple of int, tensor]. The former is widely used actually, while the latter is rarely used and will cause dynamic shape in static mode which needs extra unnecessary process. Thus, it would be better to filter it in composite rules.

Actually, tensor type for int_arrary and scalar is not legacy type, it just not suitable for composite for now. We may find a way to limit this during dy2st process

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.

Add a unit test to check if it can raise error correctly

raise ValueError(
f'No value found for {arg_name} of {arg_type} type for operator {op.type}.'
)
for item in ("tensor_name", "tensor_name"):
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a typo. Fixed.

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

@JiabinYang JiabinYang merged commit 775fb43 into PaddlePaddle:develop Mar 14, 2023
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.

2 participants