Skip to content

[PIR] Adaptation of test_zero_dim_tensor before TestSundryAPIStatic - #61575

Merged
SigureMo merged 7 commits into
PaddlePaddle:developfrom
DrRyanHuang:zero_dim1
Feb 8, 2024
Merged

SigureMo merged 7 commits into
PaddlePaddle:developfrom
DrRyanHuang:zero_dim1

Conversation

@DrRyanHuang

@DrRyanHuang DrRyanHuang commented Feb 4, 2024 •

Copy link
Copy Markdown
Collaborator

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
@DrRyanHuang
DrRyanHuang requested a review from 0x45f February 6, 2024 00:38
@DrRyanHuang
DrRyanHuang requested a review from 0x45f February 7, 2024 06:00
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
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Collaborator

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 来判断的话,将来退场是不可能知道要修改这里的

@SigureMo SigureMo left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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 来判断的话,将来退场是不可能知道要修改这里的


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

Copy link
Copy Markdown
Collaborator

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):

之后可以优化下签名~

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