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

[phi] move stft to phi - Step 1 #53517

Merged
merged 11 commits into from
May 16, 2023
Merged

[phi] move stft to phi - Step 1 #53517

merged 11 commits into from
May 16, 2023

Conversation

gouzil
Copy link
Member

@gouzil gouzil commented May 5, 2023

PR types

Others

PR changes

Others

Description

迁移stft

相关issues

@paddle-bot
Copy link

paddle-bot bot commented May 5, 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 May 5, 2023
@paddle-bot
Copy link

paddle-bot bot commented May 5, 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.

DenseTensor* out) {
using C = phi::dtype::complex<T>;

out->mutable_data<C>(ctx.GetPlace());
Copy link
Contributor

Choose a reason for hiding this comment

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

在phi下不可使用mutable_data,请用Context.Alloc接口代替

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/stft_kernel_impl.h"

PD_REGISTER_KERNEL(stft, CPU, ALL_LAYOUT, phi::StftKernel, float, double) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个算子迁移后需要注册输出类型

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@gouzil gouzil requested review from From00 May 15, 2023 08:52
const int64_t onesided_axis_size = out->dims().at(axes.back()) / 2 + 1;
onesided_dims.at(axes.back()) = onesided_axis_size;
phi::DenseTensor onesided_out;
onesided_out.mutable_data<C>(onesided_dims, ctx.GetPlace());
Copy link
Contributor

Choose a reason for hiding this comment

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

这里还有一个mutable_data

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@From00 From00 left a comment

Choose a reason for hiding this comment

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

LGTM

此算子动态图下是通过python端组合其它API实现,未调用C++端kernel,C++算子仅用于静态图。test_stft_op单测原本通过paddle.enable_static()设置只测试静态图,动态图API在test_signal中进行了测试。本PR将算子迁移到phi后,触发单测框架动态图测试拦截,因而在test_stft_op中通过设置check_dygraph=False保持静态图测试。

@phlrain phlrain self-requested a review May 16, 2023 03:18
Copy link
Collaborator

@phlrain phlrain left a comment

Choose a reason for hiding this comment

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

LGTM for check_dygraph

@From00 From00 merged commit 00c21ab into PaddlePaddle:develop May 16, 2023
@gouzil gouzil deleted the mv-stft branch August 1, 2023 16:23
@luotao1 luotao1 added the HappyOpenSource 快乐开源活动issue与PR label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource 快乐开源活动issue与PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants