From 133a40d207fecd1cd4003d70b8126ac8c1783e6e Mon Sep 17 00:00:00 2001 From: Wilber Date: Tue, 17 Sep 2019 22:15:37 +0800 Subject: [PATCH] modify norm kernel to run caffe_facedetection model (#2008) * modify norm kernel to run caffe_facedetection model * reserve bind norm, remove calc of norm output --- lite/kernels/arm/norm_compute.cc | 1 + lite/operators/op_params.h | 1 + lite/tests/kernels/norm_compute_test.cc | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lite/kernels/arm/norm_compute.cc b/lite/kernels/arm/norm_compute.cc index 3cc1645fc6..fb8b4bbe07 100644 --- a/lite/kernels/arm/norm_compute.cc +++ b/lite/kernels/arm/norm_compute.cc @@ -47,4 +47,5 @@ REGISTER_LITE_KERNEL( norm, kARM, kFloat, kNCHW, paddle::lite::kernels::arm::NormCompute, def) .BindInput("X", {LiteType::GetTensorTy(TARGET(kARM))}) .BindOutput("Out", {LiteType::GetTensorTy(TARGET(kARM))}) + .BindOutput("Norm", {LiteType::GetTensorTy(TARGET(kARM))}) .Finalize(); diff --git a/lite/operators/op_params.h b/lite/operators/op_params.h index f7e0bcd4e4..394a83f4f4 100644 --- a/lite/operators/op_params.h +++ b/lite/operators/op_params.h @@ -612,6 +612,7 @@ struct SequenceSoftmaxParam { struct NormParam { const lite::Tensor* X{}; lite::Tensor* Out{}; + lite::Tensor* Norm{}; int axis{1}; float epsilon{1e-10}; }; diff --git a/lite/tests/kernels/norm_compute_test.cc b/lite/tests/kernels/norm_compute_test.cc index 830bac0627..6aee1758c1 100644 --- a/lite/tests/kernels/norm_compute_test.cc +++ b/lite/tests/kernels/norm_compute_test.cc @@ -46,7 +46,7 @@ class NormComputeTester : public arena::TestCase { auto* x = scope->FindTensor(input_); const auto* x_data = x->data(); - int axis = axis_ < 0 ? axis + dims_.size() : axis_; + int axis = axis_ < 0 ? axis_ + dims_.size() : axis_; int pre_n = dims_.count(0, axis); int n = dims_[axis]; int post_n = dims_.count(axis + 1, dims_.size()); -- GitLab