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

[AMP OP&Test] add fp16 test for linspace #52161

Merged
merged 10 commits into from
Mar 30, 2023

Conversation

sljlp
Copy link
Contributor

@sljlp sljlp commented Mar 27, 2023

PR types

Others

PR changes

Others

Describe

add fp16 test for linspace

@paddle-bot
Copy link

paddle-bot bot commented Mar 27, 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.

@ZzSean ZzSean changed the title add fp16 test for linspace [AMP OP&Test] add fp16 test for linspace Mar 28, 2023
self.op_type = "linspace"
self.python_api = paddle.linspace
dtype = 'float32'
super().setUp()
Copy link
Contributor

@ZzSean ZzSean Mar 28, 2023

Choose a reason for hiding this comment

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

这个setUp可以直接删掉,下同

Copy link
Contributor Author

Choose a reason for hiding this comment

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

下面需要input和output跟父类不一样,这个setUp还是留着吧

Copy link
Contributor

Choose a reason for hiding this comment

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

那可以把input和ouput的赋值都抽出来,跟set_dtype结合一下

self.attrs = {'dtype': int(core.VarDesc.VarType.FP32)}

self.outputs = {'Out': np.arange(10, -1, -1).astype(dtype)}
self.outputs = {'Out': np.arange(10, -1, -1).astype(self.dtype)}
Copy link
Contributor

@ZzSean ZzSean Mar 28, 2023

Choose a reason for hiding this comment

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

这里是不是多删了self.attrs,下同

Copy link
Contributor Author

Choose a reason for hiding this comment

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

self.attrs定义写在 _set_dtype 里了

wanghuancoder
wanghuancoder previously approved these changes Mar 30, 2023
or not core.is_bfloat16_supported(core.CUDAPlace(0)),
'not supported bf16',
)
class TestLinspaceOpCommonCaseBF16(TestLinspaceOpCommonCaseFP16):
Copy link
Contributor

Choose a reason for hiding this comment

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

直接继承的TestLinspaceOpCommonCase,里面调用了check_output,当前kernel没有注册CPU的bf16支持,所以会跑到CPU的place上,然后报错

@sljlp sljlp merged commit 40b30f5 into PaddlePaddle:develop Mar 30, 2023
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.

3 participants