-
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
[AMP OP&Test]stack & unstack ops fp16 bf16 support #50999
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -25,4 +25,6 @@ PD_REGISTER_KERNEL(unstack_grad, | |||
float, | |||
double, | |||
int, | |||
int64_t) {} | |||
int64_t, |
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.
本次修改暂不修改CPU,只针对GPU
double, | ||
int, | ||
int64_t, | ||
phi::dtype::float16, |
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 initParameters(self): | ||
self.dtype = np.float16 | ||
|
||
def test_check_grad(self): |
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.
这里为什么没有直接使用原来的test_check_grad
self.initParameters() | ||
self.op_type = 'unstack' | ||
self.python_api = paddle.unstack | ||
self.x = np.random.random(size=self.input_dim).astype(float) |
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.
astype(float)
需要改成astype(np.float32)
,否则在python中直接使用float的话会是64bits的
|
||
def test_check_grad(self): | ||
place = core.CUDAPlace(0) | ||
with fluid.dygraph.guard(): |
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.
这里反向的写法最好还是跟TestUnStackOpBase保持一致吧
@@ -64,6 +66,41 @@ def test_check_grad(self): | |||
self.check_grad(['X'], self.get_y_names(), check_eager=True) | |||
|
|||
|
|||
def unstack_grad_fp16(dout): |
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.
LGTM
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
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
New features
PR changes
Others
Describe
add fp16/bf16 support 4 stack & unstack ops