Skip to content

[PIR] Adaptation of test_zero_dim_tensor TestSundryAPIStatic - #61577

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

SigureMo merged 8 commits into
PaddlePaddle:developfrom
DrRyanHuang:zero_dim2

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 TestSundryAPIStatic Feb 4, 2024
@DrRyanHuang
DrRyanHuang requested a review from 0x45f February 6, 2024 01:29
res = self.exe.run(prog, fetch_list=[x, out] + grad_list)
self.assertEqual(res[0].shape, ())
self.assertEqual(res[1].shape, ())
if len(grad_list) > 0:

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.

这里的判断是说len(grad_list)可能==0吗,grad_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.

因为有时候梯度为 None, 所以数量会变

A0CC868C-729D-44A6-9469-CF125CE19E3F

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.

因为有时候梯度为 None, 所以数量会变

单测应该是确定的事情,如果这里确实不应该有梯度,那么就应该 assert 是 None

可以看看老 IR 下是不是 None 呢?

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.

这是老IR的结果:
image
不是 None

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.

那就是新老 IR 无法对齐咯,这里如果方便的话,可以定位下问题,建议单独 PR 处理~

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.

已在 #61413 中做记录

@DrRyanHuang
DrRyanHuang requested a review from 0x45f February 6, 2024 07:53
res = self.exe.run(prog, fetch_list=[x, out] + grad_list)
self.assertEqual(res[0].shape, ())
self.assertEqual(res[1].shape, ())
if len(grad_list) > 0:

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.

因为有时候梯度为 None, 所以数量会变

单测应该是确定的事情,如果这里确实不应该有梯度,那么就应该 assert 是 None

可以看看老 IR 下是不是 None 呢?

@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

@SigureMo
SigureMo merged commit 72c7c40 into PaddlePaddle:develop Feb 7, 2024
@DrRyanHuang
DrRyanHuang deleted the zero_dim2 branch February 7, 2024 15:21
@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