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] Adaptation of test_zero_dim_tensor before TestSundryAPIStatic #61575

Merged
merged 7 commits into from
Feb 8, 2024

Conversation

DrRyanHuang
Copy link
Member

@DrRyanHuang DrRyanHuang commented Feb 4, 2024

PR types

Others

PR changes

Others

Description

@DrRyanHuang DrRyanHuang changed the title Update test_zero_dim_tensor.py [PIR] Adaptation of test_zero_dim_tensor before TestSundryAPIStatic Feb 4, 2024
test/legacy_test/test_zero_dim_tensor.py Outdated Show resolved Hide resolved
test/legacy_test/test_zero_dim_tensor.py Outdated Show resolved Hide resolved
test/legacy_test/test_zero_dim_tensor.py Outdated Show resolved Hide resolved
test/legacy_test/test_zero_dim_tensor.py Outdated Show resolved Hide resolved
Comment on lines 391 to 395
self.assertEqual(res[0].shape, ())
if len(res) > 1:
self.assertEqual(res[1].shape, ())
if len(res) > 2:
self.assertEqual(res[2].shape, (3, 5))
Copy link
Member

Choose a reason for hiding this comment

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

确认下,这里 PIR 是没跑到么?为啥这里直接用 assertEqual 可以跑过呢?PIR shape 应该是 list

Copy link
Member Author

Choose a reason for hiding this comment

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

是的 paddle.anypaddle.all 这俩不可微分API 在PIR下没跑到,按理说PIR下是对的,梯度不存在就行,旧IR下是一个全1的矩阵

Copy link
Member

Choose a reason for hiding this comment

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

这样的话,下个 PR 加一个注释吧,因为单测不应该有这样的不确定性,这对未来退场也是不友好的,可以考虑写成 in_pir_mode 如何,否则如何的形式,根据 len 来判断的话,将来退场是不可能知道要修改这里的

Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

LGTMeow

Comment on lines 391 to 395
self.assertEqual(res[0].shape, ())
if len(res) > 1:
self.assertEqual(res[1].shape, ())
if len(res) > 2:
self.assertEqual(res[2].shape, (3, 5))
Copy link
Member

Choose a reason for hiding this comment

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

这样的话,下个 PR 加一个注释吧,因为单测不应该有这样的不确定性,这对未来退场也是不友好的,可以考虑写成 in_pir_mode 如何,否则如何的形式,根据 len 来判断的话,将来退场是不可能知道要修改这里的

@@ -198,6 +209,13 @@ def test_static_unary(self):

# Use to test zero-dim of reduce API
class TestReduceAPI(unittest.TestCase):
def assertShapeEqual(self, out, target_tuple):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def assertShapeEqual(self, out, target_tuple):
def assertShapeEqual(self, actual_shape, expected_shape):

之后可以优化下签名~

@SigureMo SigureMo merged commit 1f4a846 into PaddlePaddle:develop Feb 8, 2024
30 checks passed
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants