-
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
【PaddlePaddle Hackathon 4】No.63 fix eye and frame #51531
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
标题中加一下NO 序号 |
@ZzSean 辛苦review下~ |
paddle/phi/kernels/eye_kernel.h
Outdated
@@ -16,6 +16,7 @@ | |||
|
|||
#include "paddle/phi/common/scalar.h" | |||
#include "paddle/phi/core/dense_tensor.h" | |||
#include "paddle/phi/core/device_context.h" |
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.
这个是有必要加的吗
paddle/phi/kernels/gpu/eye_kernel.cu
Outdated
#include "paddle/phi/backends/gpu/gpu_context.h" | ||
#include "paddle/phi/common/data_type.h" |
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.
这个也可以不加?
@@ -178,6 +179,53 @@ def test_error(self): | |||
paddle.eye(-1) | |||
|
|||
|
|||
@unittest.skipIf( |
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.
fp16的单测不用加个跳过
self.op_type = "eye" | ||
self.dtype = np.float16 | ||
self.python_api = paddle.eye | ||
self.__class__.op_type = self.op_type |
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.
这一行也不需要加
or not core.is_float16_supported(core.CUDAPlace(0)), | ||
"core is not complied with CUDA and not support the float16", | ||
) | ||
class TestEyeFP16OP(OpTest): |
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.
是否可以对TestEyeOp做一些修改,然后直接继承,增加一个init_dtype函数,只修改self.dtype,可以参考#50723
@@ -137,5 +138,96 @@ def initTestCase(self): | |||
return input_shape, input_type, attrs | |||
|
|||
|
|||
@unittest.skipIf( |
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.
同上,fp16单测不用跳过
or not core.is_float16_supported(core.CUDAPlace(0)), | ||
"core is not complied with CUDA and not support the float16", | ||
) | ||
class TestFrameFP16OP(OpTest): |
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.
同上建议,直接继承TestFrameOp
self.__class__.op_type = self.op_type | ||
self.shape, self.dtype, self.attrs = self.initTestCase() | ||
x = np.random.random(size=self.shape).astype(np.float32) | ||
out = frame_from_librosa(x, **self.attrs).astype(np.float64) |
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(np.float64)
def test_check_output(self): | ||
paddle.enable_static() | ||
place = core.CUDAPlace(0) | ||
self.check_output_with_place(place, atol=1e-3) |
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.
使用默认值,无需设置atol
place, | ||
['X'], | ||
'Out', | ||
max_relative_error=1e-2, |
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.
同上
修改好了~,新的PR为:#51819 |
PR types
Others
PR changes
APIs
Describe
相关链接:
#51281