Skip to content

Commit

Permalink
fix ptq fc attr name fuse_activation->activation_type
Browse files Browse the repository at this point in the history
  • Loading branch information
sfraczek committed Feb 9, 2022
1 parent 52e3b7a commit ffd0233
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion paddle/fluid/inference/api/mkldnn_quantizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,15 @@ void AnalysisPredictor::MkldnnQuantizer::CalculateScalesForOpOutputs(
// force unsigned type if already know it
bool is_unsigned = false;
bool compute_scale = true;
if (op->Type() == "conv2d" || op->Type() == "fc") {
if (op->Type() == "conv2d") {
// output of conv2d with relu must be unsigned
std::string fuse_activation =
op->GetAttrIfExists<std::string>("fuse_activation");
is_unsigned = (fuse_activation == "relu" || fuse_activation == "relu6");
} else if (op->Type() == "fc") {
std::string activation_type =
op->GetAttrIfExists<std::string>("activation_type");
is_unsigned = (activation_type == "relu" || activation_type == "relu6");
} else if (op->Type() == "relu") {
is_unsigned = true;
} else if (op->Type() == "transpose2" || op->Type() == "reshape2" ||
Expand Down

0 comments on commit ffd0233

Please sign in to comment.