Skip to content

Commit

Permalink
add relu op to check for uint8
Browse files Browse the repository at this point in the history
  • Loading branch information
sfraczek committed Feb 9, 2022
1 parent 9a96a10 commit 52e3b7a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions paddle/fluid/framework/ir/mkldnn/cpu_quantize_squash_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,19 @@ bool CPUQuantizeSquashPass::IsDequantizeInputUint8(
if (dequant_in->inputs[0]->IsOp()) {
auto prev_op = dequant_in->inputs[0]->Op();
std::string act_name;
if (prev_op->Type() == "conv2d") {
act_name = "fuse_activation";
} else if (prev_op->Type() == "fc") {
act_name = "activation_type";
}
if (!act_name.empty()) {
auto act = prev_op->GetAttrIfExists<std::string>(act_name);
if (act == "relu" || act == "relu6") {
return true;
if (prev_op->Type() == "relu") {
return true;
} else {
if (prev_op->Type() == "conv2d") {
act_name = "fuse_activation";
} else if (prev_op->Type() == "fc") {
act_name = "activation_type";
}
if (!act_name.empty()) {
auto act = prev_op->GetAttrIfExists<std::string>(act_name);
if (act == "relu" || act == "relu6") {
return true;
}
}
}
}
Expand Down

0 comments on commit 52e3b7a

Please sign in to comment.