From 0bef76dbca48ff67e5ceaa4a8ae2ac8e6183a357 Mon Sep 17 00:00:00 2001 From: MaxwellDing Date: Wed, 1 Jul 2020 10:05:33 +0800 Subject: [PATCH] refactor: merge MLU config API (#118) --- lite/api/paddle_api.cc | 9 +++------ lite/api/paddle_api.h | 15 +++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lite/api/paddle_api.cc b/lite/api/paddle_api.cc index 1ff7b482aa..215b1b0d5a 100644 --- a/lite/api/paddle_api.cc +++ b/lite/api/paddle_api.cc @@ -238,13 +238,10 @@ void CxxConfig::set_mlu_core_number(int core_number) { void CxxConfig::set_mlu_input_layout(DataLayoutType layout) { mlu_input_layout_ = layout; } -void CxxConfig::set_mlu_use_first_conv(bool use_first_conv) { - mlu_use_first_conv_ = use_first_conv; -} -void CxxConfig::set_mlu_first_conv_mean(const std::vector &mean) { +void CxxConfig::set_mlu_firstconv_param(const std::vector &mean, + const std::vector &std) { + mlu_use_first_conv_ = true; mlu_first_conv_mean_ = mean; -} -void CxxConfig::set_mlu_first_conv_std(const std::vector &std) { mlu_first_conv_std_ = std; } lite_api::MLUCoreVersion CxxConfig::mlu_core_version() const { diff --git a/lite/api/paddle_api.h b/lite/api/paddle_api.h index 79ab98da79..3417242c6b 100644 --- a/lite/api/paddle_api.h +++ b/lite/api/paddle_api.h @@ -184,17 +184,16 @@ class LITE_API CxxConfig : public ConfigBase { void set_mlu_core_version(lite_api::MLUCoreVersion core_version); // set MLU core number, which is used when compiling MLU kernels void set_mlu_core_number(int core_number); - // set MLU input layout. User can specify layout of input data to be NHWC, - // default is NCHW - void set_mlu_input_layout(DataLayoutType layout); // whether use MLU's first conv kernel. First conv is a special kernel // provided by MLU, its input is uint8, and also needs two 3-dimentional // vectors which save all inputs' mean and std values - void set_mlu_use_first_conv(bool use_first_conv); - // set the 3-dimentional mean vector used by MLU's first conv - void set_mlu_first_conv_mean(const std::vector& mean); - // set the 3-dimentional std vector used by MLU's first conv - void set_mlu_first_conv_std(const std::vector& std); + // set the 3-dimentional mean vector and 3-dimentional std vector used by + // MLU's first conv + void set_mlu_firstconv_param(const std::vector& mean, + const std::vector& std); + // set MLU input layout. User can specify layout of input data to be NHWC, + // default is NCHW + void set_mlu_input_layout(DataLayoutType layout); lite_api::MLUCoreVersion mlu_core_version() const; int mlu_core_number() const; -- GitLab