Skip to content

Conversation

@YuanRisheng
Copy link
Contributor

PR types

Others

PR changes

Others

Describe

将三角函数系列及Relu的前反向Kernel移动到Phi下

@paddle-bot-old
Copy link

paddle-bot-old bot commented Mar 4, 2022

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 5, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 5, 2022
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 5, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 5, 2022
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 5, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 5, 2022
@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 6, 2022
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 6, 2022
#include "paddle/phi/common/bfloat16.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/activation_kernel.h"
Copy link
Contributor

Choose a reason for hiding this comment

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

kernel头文件在前

Copy link
Contributor 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/common/bfloat16.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/activation_kernel.h"
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
Contributor Author

Choose a reason for hiding this comment

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

done

}

template <typename T, typename Context, typename Functor>
void ActivationGradImpl(const Context& dev_ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

grad_impl和impl分头文件放置?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

#define ToString(x) #x

template <typename T, typename Context, typename Functor>
void ActivationImpl(const Context& dev_ctx,
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的impl是不是只有cpu kernel用了?需要impl.h吗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不是,这个存在cuda kernel使用的情况

template <typename T>
using ReluGradGradFunctor = phi::funcs::ReluGradGradFunctor<T>;
template <typename T>
struct ReluCUDAFunctor : public BaseActivationFunctor<T> {
Copy link
Contributor

Choose a reason for hiding this comment

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

这个ReluCUDAFunctor是在后面PR迁吗?

Copy link
Contributor 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/common/bfloat16.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/activation_kernel.h"
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
Contributor 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/enforce.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/eigen/common.h"

Copy link
Contributor

Choose a reason for hiding this comment

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

这些activation_functor放到funcs下有什么考虑吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

非activation的kernel也会调用

Copy link
Contributor

@XiaoguangHu01 XiaoguangHu01 left a comment

Choose a reason for hiding this comment

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

LGTM

@YuanRisheng YuanRisheng merged commit 975f99a into PaddlePaddle:develop Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants