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 TestSundryAPIStatic #61577

Merged
merged 8 commits into from
Feb 7, 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 TestSundryAPIStatic Feb 4, 2024
test/legacy_test/test_zero_dim_tensor.py Show resolved Hide resolved
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
Contributor

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
Member 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
Member

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
Member 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
Member

Choose a reason for hiding this comment

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

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

Copy link
Member Author

Choose a reason for hiding this comment

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

已在 #61413 中做记录

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 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
test/legacy_test/test_zero_dim_tensor.py Show resolved Hide resolved
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
Member

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

test/legacy_test/test_zero_dim_tensor.py Show resolved Hide resolved
@SigureMo SigureMo merged commit 72c7c40 into PaddlePaddle:develop Feb 7, 2024
30 checks passed
@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