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

【PaddlePaddle Hackathon 4】No.63 fix eye and frame #51531

Closed
wants to merge 0 commits into from

Conversation

longranger2
Copy link
Contributor

@longranger2 longranger2 commented Mar 12, 2023

PR types

Others

PR changes

APIs

Describe

  • add eye fp16 test and bfp16 support
  • add frame fp16 test and bfp16 support

相关链接:
#51281

@paddle-bot
Copy link

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

@luotao1
Copy link
Contributor

luotao1 commented Mar 13, 2023

标题中加一下NO 序号

@longranger2 longranger2 changed the title 【PaddlePaddle Hackathon 4】fix eye and frame 【PaddlePaddle Hackathon 4】No.63 fix eye and frame Mar 13, 2023
@longranger2
Copy link
Contributor Author

@ZzSean 辛苦review下~

@longranger2 longranger2 changed the title 【PaddlePaddle Hackathon 4】No.63 fix eye and frame 【PaddlePaddle Hackathon 4】No.64 fix eye and frame Mar 15, 2023
@longranger2 longranger2 changed the title 【PaddlePaddle Hackathon 4】No.64 fix eye and frame 【PaddlePaddle Hackathon 4】No.63 fix eye and frame Mar 15, 2023
@@ -16,6 +16,7 @@

#include "paddle/phi/common/scalar.h"
#include "paddle/phi/core/dense_tensor.h"
#include "paddle/phi/core/device_context.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是有必要加的吗

#include "paddle/phi/backends/gpu/gpu_context.h"
#include "paddle/phi/common/data_type.h"
Copy link
Contributor

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(
Copy link
Contributor

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
Copy link
Contributor

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):
Copy link
Contributor

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(
Copy link
Contributor

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):
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

@longranger2
Copy link
Contributor Author

修改好了~,新的PR为:#51819

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