-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[fp16] suppot fp16 in std #50936
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
❌ The PR is not created using PR's template. You can refer to this Demo. |
check_variable_and_dtype(x, 'x', ['float32', 'float64'], 'var') | ||
check_variable_and_dtype( | ||
x, 'x', ['float16', 'float32', 'float64'], 'var' | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var的文档也要记得修改哈。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的哈👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还是遗漏了上面var的文档修改
|
||
assert np.array_equal(res[0].shape, [12 * 14]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert np.array_equal(res[0].shape, [12 * 14]) |
运行结果的形状可能为1。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,我修改下
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], | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单独建立一个class 继承 (unittest.TestCase)比较好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR types
Others
PR changes
APIs
Describe
#50832 case30
对应的中文文档为: PaddlePaddle/docs#5668