-
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
Move some activation to phi #40727
Move some activation to phi #40727
Conversation
… move_temporal_shift_to_phi
… move_temporal_shift_to_phi
… move_temporal_shift_to_phi
… move_temporal_shift_to_phi
… move_some_activaion_to_phi
你的PR提交成功,感谢你对开源项目的贡献! |
typename dX> | ||
void operator()(Device d, X x, Out out, dOut dout, dX dx) const { | ||
dx.device(d) = static_cast<T>(0.5) * dout / out; | ||
struct SqrtGradGradFunctor : public BaseActivationFunctor<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.
二阶导是后边的pr迁移吗
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来搞
functor(place, eigen_in, eigen_out, eigen_p, eps); | ||
} | ||
}; | ||
|
||
template <typename DeviceContext, typename T> | ||
class LogitGradKernel : public framework::OpKernel<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.
Kernel已迁,这个可以删掉
// REGISTER_OPERATOR( | ||
// expm1, ops::ActivationOp, ops::Expm1OpMaker, | ||
// ops::ActivationOpInferVarType, | ||
// ops::ActivationGradOpMaker<ops::Expm1GradFunctor<float>::FwdDeps(), | ||
// paddle::framework::OpDesc>, | ||
// ops::ActivationGradOpMaker<ops::Expm1GradFunctor<float>::FwdDeps(), | ||
// paddle::imperative::OpBase>, | ||
// std::conditional<ops::CanInplaceAct<ops::Expm1GradFunctor<float>>(), | ||
// ops::ActFwdInplaceInferer, void>::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.
无用注释删掉
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.
done
}; | ||
|
||
template <typename T> | ||
struct CudaMishGradFunctor : public BaseActivationFunctor<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.
这些cuda functor也需要使用USE_PHI_FUNCTOR引过来,这个文件里还有xpu的注册需要用到这些functor
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.
done
// template <typename T> | ||
// struct SoftsignGradFunctor : public BaseActivationFunctor<T> { | ||
// template <typename Device, typename X, typename Out, typename dOut, | ||
// typename dX> | ||
// void operator()(Device d, X x, Out out, dOut dout, dX dx) { | ||
// dx.device(d) = | ||
// dout * (static_cast<T>(1) / (static_cast<T>(1) + x.abs()).square()); | ||
// } | ||
|
||
// static constexpr ActBwdOpFwdDeps FwdDeps() { return ActBwdOpFwdDeps::kDepX; | ||
// } | ||
// }; |
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.
done
// functor(*place, To32BitIndex(x), To32BitIndex(out)); | ||
functor(*place, x, out); |
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.
误操作,我回复过去
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.
done
@@ -1675,7 +1679,6 @@ REGISTER_OPERATOR( | |||
ops::ActivationOpDoubleGrad<ops::SqrtGradGradFunctor<float>::FwdDeps()>, | |||
ops::ActivationDoubleGradOpInplaceInferer); | |||
|
|||
REGISTER_ACTIVATION_CPU_KERNEL(sqrt, Sqrt, SqrtFunctor, SqrtGradFunctor); |
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.
sqrt和square有SelcetedRows类型的输入,在selectedrows未迁移的情况下删掉这里会不会出现问题
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.
我恢复下
修复infrt CI 失败的问题: |
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
// REGISTER_OPERATOR( | ||
// expm1, ops::ActivationOp, ops::Expm1OpMaker, | ||
// ops::ActivationOpInferVarType, | ||
// ops::ActivationGradOpMaker<ops::Expm1GradFunctor<float>::FwdDeps(), | ||
// paddle::framework::OpDesc>, | ||
// ops::ActivationGradOpMaker<ops::Expm1GradFunctor<float>::FwdDeps(), | ||
// paddle::imperative::OpBase>, | ||
// std::conditional<ops::CanInplaceAct<ops::Expm1GradFunctor<float>>(), | ||
// ops::ActFwdInplaceInferer, void>::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.
这里是不是没删
template <typename T, typename Context> | ||
void ClipByNormSparseKernel(const Context& ctx, | ||
const SelectedRows& x, | ||
float max_norm, |
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.
selected rows移动到对应目录
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.
clip by norm有其他的注册问题,单独提pr处理
|
||
} // namespace phi | ||
|
||
// PD_REGISTER_KERNEL( |
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.
clip by norm有其他的注册问题,单独提pr处理
return KernelSignature("sqrt", {"X"}, {}, {"Out"}); | ||
} | ||
|
||
return KernelSignature("unregistered", {}, {}, {}); |
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.
如果迁移完整的话,应该不需要unregister
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.
done
if (ctx.IsDenseTensorInput("X")) { | ||
return KernelSignature("clip_by_norm", {"X"}, {"max_norm"}, {"Out"}); | ||
} else { | ||
return KernelSignature("clip_by_norm_sparse", {"X"}, {"max_norm"}, {"Out"}); |
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.
selected rows和已有的命名风格保持一致
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.
clip by norm有其他的注册问题,单独提pr处理
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
… move_some_activaion_to_phi
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
Breaking changes
PR changes
OPs
Describe
move activation to phi