Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle-Lite
Browse files Browse the repository at this point in the history
…into fix_fill_op test=huawei_ascend_npu
  • Loading branch information
shentanyue committed Oct 22, 2021
2 parents 3bbbe1e + 66a7c61 commit e55d24f
Show file tree
Hide file tree
Showing 23 changed files with 328 additions and 158 deletions.
11 changes: 10 additions & 1 deletion cmake/postproject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,17 @@ endif()
if (LITE_ON_TINY_PUBLISH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -Ofast -Os -fomit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -ffunction-sections")
# 1. strip useless symbols from third-party libs
# exclude-libs is not supported on macOs system
if(NOT ARMMACOS)
check_linker_flag(-Wl,--gc-sections)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--exclude-libs,ALL")
check_linker_flag(-Wl,--gc-sections)
endif()
# 2. strip rtti lib to reduce lib size
# 2.1 replace typeid by fastTypeId
# 2.2 replace dynamic_cast by static_cast
if(NOT LITE_WITH_NNADAPTER)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
endif()
endif()

Expand Down
20 changes: 10 additions & 10 deletions docs/api_reference/cxx_api_doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## CreatePaddlePredictor

\#include <[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_api.h)>
\#include <[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_api.h)>

```c++
template <typename ConfigT>
Expand Down Expand Up @@ -32,7 +32,7 @@ std::shared_ptr<PaddlePredictor> predictor = CreatePaddlePredictor<MobileConfig>

## CxxConfig

\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_api.h)&gt;
\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_api.h)&gt;

```c++
class CxxConfig;
Expand Down Expand Up @@ -244,7 +244,7 @@ int x86_math_num_threads() const;

## MobileConfig

\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_api.h)&gt;
\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_api.h)&gt;

```c++
class MobileConfig;
Expand Down Expand Up @@ -474,7 +474,7 @@ int threads() const

## PaddlePredictor

\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_api.h)&gt;
\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_api.h)&gt;

```c++
class PaddlePredictor
Expand Down Expand Up @@ -650,7 +650,7 @@ virtual std::string GetVersion() const = 0;

## TargetType

\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_place.h)&gt;
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_place.h)&gt;

```c++
class TargetType;
Expand All @@ -661,7 +661,7 @@ class TargetType;

## PrecisionType

\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_place.h)&gt;
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_place.h)&gt;

```c++
class PrecisionType;
Expand All @@ -672,7 +672,7 @@ class PrecisionType;

## DataLayoutType

\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_place.h)&gt;
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_place.h)&gt;

```c++
class DataLayoutType;
Expand All @@ -683,7 +683,7 @@ class DataLayoutType;

## Place

\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_place.h)&gt;
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_place.h)&gt;

`Place``TargetType``PrecisionType``DataLayoutType`的集合,说明运行时的设备类型、数据精度和数据格式。

Expand All @@ -694,7 +694,7 @@ Place{TargetType(ARM), PrecisionType(FP32), DataLayoutType(NCHW)}
## PowerMode
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_place.h)&gt;
\#include &lt;[paddle\_place.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_place.h)&gt;
```c++
enum PowerMode;
Expand Down Expand Up @@ -728,7 +728,7 @@ PowerMode详细说明如下:


## Tensor
\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/v2.9.1/lite/api/paddle_api.h)&gt;
\#include &lt;[paddle\_api.h](https://github.com/PaddlePaddle/Paddle-Lite/tree/develop/lite/api/paddle_api.h)&gt;

```c++
struct Tensor
Expand Down
124 changes: 62 additions & 62 deletions docs/develop_guides/add_hardware.md

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions docs/source_compile/compile_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
| :-- | :-- |--: |
| LITE_WITH_LOG | 是否输出日志信息 | ON |
| LITE_WITH_EXCEPTION | 是否在错误发生时抛出异常 | OFF |
| LITE_WITH_TRAIN | 打开[模型训练功能](../demo_guides/cpp_train_demo.md),支持移动端模型训练 | OFF |
| LITE_BUILD_EXTRA | 编译[全量预测库](library.md),包含更多算子和模型支持 | OFF |
| LITE_BUILD_TAILOR | 编译时[根据模型裁剪预测库](library_tailoring.rst),缩小预测库大小 | OFF |
| LITE_WITH_TRAIN | 打开[模型训练功能](https://paddle-lite.readthedocs.io/zh/develop/demo_guides/cpp_train_demo.html),支持移动端模型训练 | OFF |
| LITE_BUILD_EXTRA | 编译[全量预测库](https://paddle-lite.readthedocs.io/zh/develop/source_compile/library.html),包含更多算子和模型支持 | OFF |
| LITE_BUILD_TAILOR | 编译时[根据模型裁剪预测库](https://paddle-lite.readthedocs.io/zh/develop/source_compile/library_tailoring.html),缩小预测库大小 | OFF |
| WITH_SYSTEM_BLAS | 编译时强制使用 reference BLAS | OFF |

### 轻量级编译选项
Expand All @@ -25,26 +25,26 @@

| 编译选项 | 说明 | 默认值 |
| :-- | :-- | --: |
| LITE_WITH_PROFILE | 编译[性能 Profiler 工具](../user_guides/profiler.md),用于 kernel 耗时统计 | OFF |
| LITE_WITH_PRECISION_PROFILE | 编译[精度 Profiler 工具](../user_guides/profiler.md),用于 kernel 精度分析 | OFF |
| LITE_WITH_PROFILE | 编译[性能 Profiler 工具](https://paddle-lite.readthedocs.io/zh/develop/user_guides/profiler.html),用于 kernel 耗时统计 | OFF |
| LITE_WITH_PRECISION_PROFILE | 编译[精度 Profiler 工具](https://paddle-lite.readthedocs.io/zh/develop/user_guides/profiler.html),用于 kernel 精度分析 | OFF |
| WITH_TESTING | 编译 Lite 单测模块 | OFF |

## 部分平台相关编译选项

| 编译选项 | 说明 | 适用平台 | 默认值 |
| :-- | :-- | --: | --: |
| LITE_WITH_ARM | 编译支持 Andriod 或 ARMLinux 平台预测库 | Andriod / ARMLinux | OFF |
| LITE_WITH_JAVA | 编译支持 [Java API](../api_reference/java_api_doc.md) 的预测库 | Andriod / ARMLinux | OFF |
| LITE_WITH_JAVA | 编译支持 [Java API](https://paddle-lite.readthedocs.io/zh/develop/api_reference/java_api_doc.html) 的预测库 | Andriod / ARMLinux | OFF |
| LITE_WITH_ARM_CLANG | 使用 clang 编译 ARM 平台预测库 | Andriod / ARMLinux |OFF |
| WITH_ARM_DOTPROD | 编译 ARM 点积指令优化的预测库 | Andriod / ARMLinux |ON |
| LITE_WITH_CV | 编译 [CV 图像加速库](../api_reference/cv.md) | Andirod / ARMLinux |OFF |
| LITE_WITH_CV | 编译 [CV 图像加速库](https://paddle-lite.readthedocs.io/zh/develop/api_reference/cv.html) | Andirod / ARMLinux |OFF |
| ANDROID_API_LEVEL | 设置安卓 API LEVEL | Android | Default,即 ARMv7 下为16,ARMv8 下为21 |
| LITE_WITH_OPENMP | 编译时打开 OpenMP | ARMLinux / X86 | ON |
| LITE_WITH_X86 | 编译[ X86 平台](../demo_guides/x86.md)预测库 | X86 | ON |
| LITE_WITH_X86 | 编译[ X86 平台](https://paddle-lite.readthedocs.io/zh/develop/demo_guides/x86.html)预测库 | X86 | ON |
| WITH_AVX | 编译有 AVX 指令优化的预测库 | X86 |ON IF ${AVX_FOUND} |
| WITH_MKL | 编译有 Intel MKL 支持的预测库 | X86 |ON IF ${AVX_FOUND} |
| LITE_ON_MODEL_OPTIMIZE_TOOL | 编译[模型优化工具 opt](../user_guides/model_optimize_tool.md) | X86 |OFF|
| LITE_WITH_PYTHON | 编译支持 [Python API](../api_reference/python_api_doc.md) 的预测库 | X86 / CUDA |OFF |
| LITE_WITH_OPENCL | 编译 [OpenCL 平台](../demo_guides/opencl.md)预测库 | OpenCL | OFF |
| LITE_WITH_XPU | 编译[百度 XPU 平台](../demo_guides/baidu_xpu.md)预测库 | XPU |OFF |
| LITE_ON_MODEL_OPTIMIZE_TOOL | 编译[模型优化工具 opt](https://paddle-lite.readthedocs.io/zh/develop/user_guides/model_optimize_tool.html) | X86 |OFF|
| LITE_WITH_PYTHON | 编译支持 [Python API](https://paddle-lite.readthedocs.io/zh/develop/api_reference/python_api_doc.html) 的预测库 | X86 / CUDA |OFF |
| LITE_WITH_OPENCL | 编译 [OpenCL 平台](https://paddle-lite.readthedocs.io/zh/develop/demo_guides/opencl.html)预测库 | OpenCL | OFF |
| LITE_WITH_XPU | 编译[百度 XPU 平台](https://paddle-lite.readthedocs.io/zh/develop/demo_guides/baidu_xpu.html)预测库 | XPU |OFF |
| LITE_WITH_XTCL | 通过 XTCL 方式支持百度 XPU,默认 Kernel 方式 | XPU |OFF IF LITE_WITH_XPU |
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ __kernel void broadcast_elementwise_common(
in0 = READ_IMG_TYPE(
CL_DTYPE_CHAR, input_x, SAMPLER, (int2)(cur_index.x * 4, cur_index.y));

if (cur_index.x * 4 + 1 < input_nhwc4.w * 4) {
if (cur_index.x * 4 + 1 < bias_width) {
in1 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(cur_index.x * 4 + 1, cur_index.y));
}
if (cur_index.x * 4 + 2 < input_nhwc4.w * 4) {
if (cur_index.x * 4 + 2 < bias_width) {
in2 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(cur_index.x * 4 + 2, cur_index.y));
}
if (cur_index.x * 4 + 3 < input_nhwc4.w * 4) {
if (cur_index.x * 4 + 3 < bias_width) {
in3 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
Expand All @@ -100,19 +100,19 @@ __kernel void broadcast_elementwise_common(
in0 = READ_IMG_TYPE(
CL_DTYPE_CHAR, input_x, SAMPLER, (int2)(cur_index.y, cur_index.x * 4));

if (cur_index.x * 4 + 1 < input_nhwc4.z * input_nhwc4.w * 4) {
if (cur_index.x * 4 + 1 < bias_width) {
in1 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(cur_index.y, cur_index.x * 4 + 1));
}
if (cur_index.x * 4 + 2 < input_nhwc4.z * input_nhwc4.w * 4) {
if (cur_index.x * 4 + 2 < bias_width) {
in2 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(cur_index.y, cur_index.x * 4 + 2));
}
if (cur_index.x * 4 + 3 < input_nhwc4.z * input_nhwc4.w * 4) {
if (cur_index.x * 4 + 3 < bias_width) {
in3 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
Expand Down Expand Up @@ -140,19 +140,19 @@ __kernel void broadcast_elementwise_common(
SAMPLER,
(int2)(tmp_c4 * input_nhwc4.y + tmp_w, tmp_h));

if (cur_index.x + 1 < input_nhwc4.x * input_nhwc4.y) {
if (tmp_h + 1 < bias_width) {
in1 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(tmp_c4 * input_nhwc4.y + tmp_w, tmp_h + 1));
}
if (cur_index.x + 2 < input_nhwc4.x * input_nhwc4.y) {
if (tmp_h + 2 < bias_width) {
in2 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
(int2)(tmp_c4 * input_nhwc4.y + tmp_w, tmp_h + 2));
}
if (cur_index.x + 3 < input_nhwc4.x * input_nhwc4.y) {
if (tmp_h + 3 < bias_width) {
in3 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_x,
SAMPLER,
Expand Down Expand Up @@ -235,19 +235,19 @@ __kernel void broadcast_elementwise_common(
in0 = READ_IMG_TYPE(
CL_DTYPE_CHAR, input_y, SAMPLER, (int2)(cur_index.y, cur_index.x * 4));

if (cur_index.x * 4 + 1 < bias_nhwc4.z * bias_nhwc4.w * 4) {
if (cur_index.x * 4 + 1 < bias_width) {
in1 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
(int2)(cur_index.y, cur_index.x * 4 + 1));
}
if (cur_index.x * 4 + 2 < bias_nhwc4.z * bias_nhwc4.w * 4) {
if (cur_index.x * 4 + 2 < bias_width) {
in2 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
(int2)(cur_index.y, cur_index.x * 4 + 2));
}
if (cur_index.x * 4 + 3 < bias_nhwc4.z * bias_nhwc4.w * 4) {
if (cur_index.x * 4 + 3 < bias_width) {
in3 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
Expand Down Expand Up @@ -275,19 +275,19 @@ __kernel void broadcast_elementwise_common(
SAMPLER,
(int2)(tmp_c4 * bias_nhwc4.y + tmp_w, tmp_h));

if (cur_index.x + 1 < bias_nhwc4.x * bias_nhwc4.y) {
if (tmp_h + 1 < bias_width) {
in1 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
(int2)(tmp_c4 * bias_nhwc4.y + tmp_w, tmp_h + 1));
}
if (cur_index.x + 2 < bias_nhwc4.x * bias_nhwc4.y) {
if (tmp_h + 2 < bias_width) {
in2 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
(int2)(tmp_c4 * bias_nhwc4.y + tmp_w, tmp_h + 2));
}
if (cur_index.x + 3 < bias_nhwc4.x * bias_nhwc4.y) {
if (tmp_h + 3 < bias_width) {
in3 = READ_IMG_TYPE(CL_DTYPE_CHAR,
input_y,
SAMPLER,
Expand Down
4 changes: 2 additions & 2 deletions lite/core/optimizer/mir/memory_optimize_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ void MemoryOptimizePass::CollectLifeCycleByDevice(
{"flatten", {{"X"}, {"Out"}}},
{"flatten2", {{"X"}, {"Out"}}},
{"squeeze", {{"X"}, {"Out"}}},
{"squeeze2", {{"X"}, {"Out"}}},
{"squeeze2", {{"X"}, {{"Out"}, {"XShape"}}}},
{"unsqueeze", {{"X"}, {"Out"}}},
{"unsqueeze2", {{"X"}, {"Out"}}}};
{"unsqueeze2", {{"X"}, {{"Out"}, {"XShape"}}}}};
auto inplace_op_node = inplace_op_nodes.find(op_type);
if (inplace_op_node != inplace_op_nodes.end()) {
bool inplace = false;
Expand Down
2 changes: 1 addition & 1 deletion lite/core/optimizer/mir/pass_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PassManager {
template <typename PassTy>
PassTy* LookUp(const std::string& key) {
auto it = pass_map_.find(key);
if (it != pass_map_.end()) return dynamic_cast<PassTy*>(it->second);
if (it != pass_map_.end()) return static_cast<PassTy*>(it->second);
return nullptr;
}

Expand Down
4 changes: 2 additions & 2 deletions lite/kernels/npu/bridges/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ class Graph {
PrecisionType precision = PRECISION(kFloat),
DataLayoutType layout = DATALAYOUT(kNCHW)) {
Node::Role role = Node::Role::kVar;
if (typeid(T) == typeid(ge::op::Const)) {
if (FastTypeId<T>() == FastTypeId<ge::op::Const>()) {
role = Node::Role::kConst;
} else if (typeid(T) == typeid(ge::op::Data)) {
} else if (FastTypeId<T>() == FastTypeId<ge::op::Data>()) {
role = Node::Role::kData;
}
auto node = std::make_shared<Node>(precision, layout, role);
Expand Down
2 changes: 1 addition & 1 deletion lite/kernels/opencl/elementwise_image_compute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ class ElementwiseImageCompute : public KernelLite<TARGET(kOpenCL),

int inputx_broadcast_c_flag = (x_nchw_[1] == 1) ? 1 : 0;
int inputy_broadcast_c_flag = (y_nchw_[1] == 1) ? 1 : 0;
int bias_width = y_nchw_[1];
int bias_width = out_nchw_[1];

if (y_dims_ == x_dims_) {
cl_int status = kernel_.setArg(0, *x_img);
Expand Down
4 changes: 4 additions & 0 deletions lite/kernels/opencl/elementwise_image_compute_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,10 @@ void test_elementwise_all_dim_data_gpu() {
c = randint(1, 40);
h = randint(1, 40);
w = randint(1, 40);
n = 2;
c = 3;
h = 4;
w = 5;
std::vector<bool> xy_swap_flags{false, true};
for (auto xy_swap_flag : xy_swap_flags) {
RunElementwiseCommonSize<float>({n, c, h, w},
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/conv_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class ConvOpLite : public OpLite {
padding_algorithm_ = op_desc.GetAttr<std::string>("padding_algorithm");
}
// For Int8
const OpInfo* op_info = dynamic_cast<const OpInfo*>(&op_desc);
const OpInfo* op_info = static_cast<const OpInfo*>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8")) {
param_.enable_int8 = op_info->GetAttr<bool>("enable_int8");
auto input_scale_name = "Input0_scale";
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/conv_transpose_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool ConvTransposeOpLite::AttachImpl(const cpp::OpDesc& op_desc,
param_.dilations = std::make_shared<std::vector<int>>(dilations);

// For Int8
const OpInfo* op_info = dynamic_cast<const OpInfo*>(&op_desc);
const OpInfo* op_info = static_cast<const OpInfo*>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8")) {
param_.enable_int8 = op_info->GetAttr<bool>("enable_int8");
auto input_scale_name = "Input0_scale";
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/fc_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ bool FcOpLite::AttachImpl(const cpp::OpDesc& op_desc, lite::Scope* scope) {
}

// For Int8
const OpInfo* op_info = dynamic_cast<const OpInfo*>(&op_desc);
const OpInfo* op_info = static_cast<const OpInfo*>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8")) {
param_.enable_int8 = op_info->GetAttr<bool>("enable_int8");
auto input_scale_name = "Input0_scale";
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/gru_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool GRUOpLite::AttachImpl(const cpp::OpDesc& op_desc, lite::Scope* scope) {
}

// For int8
const OpInfo* op_info = dynamic_cast<const OpInfo*>(&op_desc);
const OpInfo* op_info = static_cast<const OpInfo*>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8") &&
op_info->GetAttr<bool>("enable_int8")) {
param_.enable_int8 = true;
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/lstm_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bool LstmOp::AttachImpl(const cpp::OpDesc &opdesc, lite::Scope *scope) {
GetActivationType(opdesc.GetAttr<std::string>("candidate_activation"));

// For int8
const OpInfo *op_info = dynamic_cast<const OpInfo *>(&opdesc);
const OpInfo *op_info = static_cast<const OpInfo *>(&opdesc);
if (op_info != nullptr && op_info->HasAttr("enable_int8") &&
op_info->GetAttr<bool>("enable_int8")) {
param_.enable_int8 = true;
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/matmul_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ bool MatMulOpLite::AttachImpl(const cpp::OpDesc &op_desc, lite::Scope *scope) {
param_.transpose_Y = op_desc.GetAttr<bool>("transpose_Y");
param_.alpha = op_desc.GetAttr<float>("alpha");

const OpInfo *op_info = dynamic_cast<const OpInfo *>(&op_desc);
const OpInfo *op_info = static_cast<const OpInfo *>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8")) {
param_.enable_int8 = op_info->GetAttr<bool>("enable_int8");
auto input_scale_name = "X0_scale";
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/sparse_conv_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class SparseConvOp : public OpLite {
}

// For Int8
const OpInfo* op_info = dynamic_cast<const OpInfo*>(&op_desc);
const OpInfo* op_info = static_cast<const OpInfo*>(&op_desc);
if (op_info != nullptr && op_info->HasAttr("enable_int8")) {
param_.enable_int8 = op_info->GetAttr<bool>("enable_int8");
auto input_scale_name = "Input0_scale";
Expand Down
2 changes: 1 addition & 1 deletion lite/operators/subgraph_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool SubgraphOp::AttachImpl(const cpp::OpDesc& op_desc, lite::Scope* scope) {
param_.output_data_names =
op_desc.GetAttr<std::vector<std::string>>("output_data_names");
// Get the quantization parameters of input and output data variables
auto op_info = dynamic_cast<const OpInfo*>(&op_desc);
auto op_info = static_cast<const OpInfo*>(&op_desc);
param_.input_data_scales.clear();
param_.output_data_scales.clear();
for (auto& input_data_name : param_.input_data_names) {
Expand Down
Loading

0 comments on commit e55d24f

Please sign in to comment.