提交 d60aa589 编写于 作者: H hong19860320 提交者: GitHub

[LITE][NPU] Refine batch_norm and pool2d op bridges (#2762)

上级 a31a18c6
...@@ -64,7 +64,11 @@ int BatchNormConverter(void* ctx, OpLite* op, KernelBase* kernel) { ...@@ -64,7 +64,11 @@ int BatchNormConverter(void* ctx, OpLite* op, KernelBase* kernel) {
float momentum = op_info->GetAttr<float>("momentum"); float momentum = op_info->GetAttr<float>("momentum");
float epsilon = op_info->GetAttr<float>("epsilon"); float epsilon = op_info->GetAttr<float>("epsilon");
int mode = 1; // bnScale, bnBias tensor dims are 1xCx1x1 int mode = 1; // bnScale, bnBias tensor dims are 1xCx1x1
bool use_global_stats = op_info->GetAttr<bool>("use_global_stats"); bool use_global_stats = !op_info->HasAttr("use_global_stats") ||
op_info->GetAttr<bool>("use_global_stats");
if (!use_global_stats) {
LOG(WARNING) << "[NPU] Only use_global_stats=true is supported by HiAI DDK";
}
// X node // X node
std::shared_ptr<Node> x_node = nullptr; std::shared_ptr<Node> x_node = nullptr;
......
...@@ -61,8 +61,10 @@ int PoolConverter(void* ctx, OpLite* op, KernelBase* kernel) { ...@@ -61,8 +61,10 @@ int PoolConverter(void* ctx, OpLite* op, KernelBase* kernel) {
mode = 0; mode = 0;
} else if (pooling_type == "avg") { } else if (pooling_type == "avg") {
mode = 1; mode = 1;
CHECK(op_info->GetAttr<bool>("exclusive")) if (!op_info->GetAttr<bool>("exclusive")) {
<< "[NPU] exclusive must be true in HiAI DDK"; LOG(WARNING) << "[NPU] Only exclusive=true is supported for the pooling "
"type 'avg' by HiAI DDK";
}
} else { } else {
LOG(WARNING) << "[NPU] Unsupported pooling type: " << pooling_type; LOG(WARNING) << "[NPU] Unsupported pooling type: " << pooling_type;
return FAILED; return FAILED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册