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

[Zero-Dim] OpTest support shape check and fix previous case problem #54117

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

zhwesky2010
Copy link
Contributor

@zhwesky2010 zhwesky2010 commented May 25, 2023

PR types

Function optimization

PR changes

OPs

Description

Pcard-66984

进一步增强完善0D Tensor基础设施。由于当前基类OpTest对shape的判断不严格、不规范,导致OP开发时可以轻松绕过0D的shape判断。为了拦截后续OP开发时的0D shape以及维度设置不合理等问题,因此增强基类OpTest对shape的检查功能,同时修复约40个存量单测的问题。

shape判断标准:由于np.allclose具有自动broadcast功能,所以无任何shape检查功能,例如[3]与[3, 3, 3]对比仍为True;np.testing.assert_allclose 虽具有一些shape检查功能,例如[3]与[3, 3, 3]会为False,但不具有0D shape的检查功能,例如[]与[1]仍为True。因此将此处的assert标准统一升级为:先硬性对比shape一致,再np.testing.assert_allclose

@paddle-bot
Copy link

paddle-bot bot commented May 25, 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.

@paddle-bot
Copy link

paddle-bot bot commented May 25, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

@zhwesky2010 zhwesky2010 force-pushed the 0d_optest1 branch 5 times, most recently from d332d02 to 99216d0 Compare May 26, 2023 05:09
@zhwesky2010 zhwesky2010 changed the title [Zero-Dim] class OpTest support shape check and fix previous case bug [Zero-Dim] OpTest support shape check and fix previous case bug May 26, 2023
@zhwesky2010 zhwesky2010 changed the title [Zero-Dim] OpTest support shape check and fix previous case bug [Zero-Dim] OpTest support shape check and fix previous case problem May 26, 2023
@zhwesky2010 zhwesky2010 force-pushed the 0d_optest1 branch 12 times, most recently from eb2af01 to 3b83ee3 Compare May 31, 2023 13:41
Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

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