提交 3f98791f 编写于 作者: Y Yin Zhenhua 提交者: jackzhang235

(bugfix): change kernel size from -1 to valid value while global pooling is true

(ref): add sigmoid and elementwise_mul x86 kernel interface
上级 120deff5
...@@ -72,6 +72,13 @@ int PoolConverter(void* ctx, OpLite* op, KernelBase* kernel) { ...@@ -72,6 +72,13 @@ int PoolConverter(void* ctx, OpLite* op, KernelBase* kernel) {
if (op_info->HasAttr("adaptive")) { if (op_info->HasAttr("adaptive")) {
adaptive = op_info->GetAttr<bool>("adaptive"); adaptive = op_info->GetAttr<bool>("adaptive");
} }
auto input_dims = x->dims();
if (global_pooling) {
ksize.resize(static_cast<size_t>(input_dims.size()) - 2);
for (size_t i = 0; i < ksize.size(); ++i) {
ksize[i] = static_cast<int>(input_dims[i + 2]);
}
}
lite::operators::UpdatePadding(&paddings, lite::operators::UpdatePadding(&paddings,
global_pooling, global_pooling,
adaptive, adaptive,
......
...@@ -78,3 +78,13 @@ REGISTER_LITE_KERNEL(softsign, ...@@ -78,3 +78,13 @@ REGISTER_LITE_KERNEL(softsign,
.BindInput("X", {LiteType::GetTensorTy(TARGET(kX86))}) .BindInput("X", {LiteType::GetTensorTy(TARGET(kX86))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))}) .BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))})
.Finalize(); .Finalize();
REGISTER_LITE_KERNEL(sigmoid,
kX86,
kFloat,
kNCHW,
paddle::lite::kernels::x86::SoftsignCompute<float>,
def)
.BindInput("X", {LiteType::GetTensorTy(TARGET(kX86))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))})
.Finalize();
...@@ -35,3 +35,14 @@ REGISTER_LITE_KERNEL(elementwise_add, ...@@ -35,3 +35,14 @@ REGISTER_LITE_KERNEL(elementwise_add,
.BindInput("Y", {LiteType::GetTensorTy(TARGET(kX86))}) .BindInput("Y", {LiteType::GetTensorTy(TARGET(kX86))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))}) .BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))})
.Finalize(); .Finalize();
REGISTER_LITE_KERNEL(elementwise_mul,
kX86,
kFloat,
kNCHW,
paddle::lite::kernels::x86::ElementwiseAddCompute<float>,
def)
.BindInput("X", {LiteType::GetTensorTy(TARGET(kX86))})
.BindInput("Y", {LiteType::GetTensorTy(TARGET(kX86))})
.BindOutput("Out", {LiteType::GetTensorTy(TARGET(kX86))})
.Finalize();
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册