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

[fp16] suppot fp16 in std #50936

Merged
merged 5 commits into from
Mar 2, 2023
Merged

[fp16] suppot fp16 in std #50936

merged 5 commits into from
Mar 2, 2023

Conversation

longranger2
Copy link
Contributor

@longranger2 longranger2 commented Feb 26, 2023

PR types

Others

PR changes

APIs

Describe

#50832 case30
对应的中文文档为: PaddlePaddle/docs#5668

@paddle-bot
Copy link

paddle-bot bot commented Feb 26, 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.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Feb 26, 2023
@paddle-bot
Copy link

paddle-bot bot commented Feb 26, 2023

❌ The PR is not created using PR's template. You can refer to this Demo.
Please use PR's template, it helps save our maintainers' time so that more developers get helped.

check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'var')
check_variable_and_dtype(
x, 'x', ['float16', 'float32', 'float64'], 'var'
)
Copy link
Contributor

Choose a reason for hiding this comment

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

var的文档也要记得修改哈。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的哈👌

Copy link
Contributor

Choose a reason for hiding this comment

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

还是遗漏了上面var的文档修改

Comment on lines 142 to 143

assert np.array_equal(res[0].shape, [12 * 14])
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert np.array_equal(res[0].shape, [12 * 14])

运行结果的形状可能为1。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我修改下

@longranger2 longranger2 requested review from Liyulingyue and zhangting2020 and removed request for Liyulingyue and zhangting2020 February 28, 2023 08:49
Comment on lines 121 to 142
def test_fp16_with_gpu(self):
if paddle.fluid.core.is_compiled_with_cuda():
place = paddle.CUDAPlace(0)
with paddle.static.program_guard(
paddle.static.Program(), paddle.static.Program()
):
input = np.random.random([12, 14]).astype("float16")
x = paddle.static.data(
name="x", shape=[12, 14], dtype="float16"
)

y = paddle.std(x)

exe = paddle.static.Executor(place)
res = exe.run(
paddle.static.default_main_program(),
feed={
"x": input,
},
fetch_list=[y],
)

Copy link
Contributor

Choose a reason for hiding this comment

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

单独建立一个class 继承 (unittest.TestCase)比较好

Copy link
Contributor

@zhangting2020 zhangting2020 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants