未验证 提交 94dde6ba 编写于 作者: H hong19860320 提交者: GitHub

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

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