Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ DeleteQuantDequantFilterOpPass::DeleteQuantDequantFilterOpPass() {
}
// Delete quant_dequant_op, then quantize and dequantize weight
void DeleteQuantDequantFilterOpPass::ApplyImpl(ir::Graph* graph) const {
const std::string pattern_name = "delete_quantdequant_filter_op_pattern";
const std::string pattern_name = "delete_quant_dequant_filter_op_pattern";
FusePassBase::Init(pattern_name, graph);

GraphPatternDetector gpd;
Expand Down Expand Up @@ -141,7 +141,7 @@ void DeleteQuantDequantFilterOpPass::ApplyImpl(ir::Graph* graph) const {
"the received is %d",
quant_axis));

// To Do @Wangzheee: use "OutScale" to quantdequant
// To Do @Wangzheee: use "OutScale" to quant_dequant
/*auto scales_name = quant_dequant_op->Op()->Output("OutScale");
PADDLE_ENFORCE_EQ(scales_name.size(), 1,
platform::errors::InvalidArgument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ DeleteQuantDequantLinearOpPass::DeleteQuantDequantLinearOpPass() {
}
// Delete quantize_linear_op dequantize_linear_op, then add input_scales
void DeleteQuantDequantLinearOpPass::ApplyImpl(ir::Graph* graph) const {
const std::string pattern_name = "delete_quantdequant_linear_op_pattern";
const std::string pattern_name = "delete_quant_dequant_linear_op_pattern";
FusePassBase::Init(pattern_name, graph);

GraphPatternDetector gpd;
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/framework/ir/delete_quant_dequant_op_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ namespace ir {
GET_IR_NODE(quant_dequant_op_out);

void DeleteQuantDequantOpPass::ApplyImpl(ir::Graph* graph) const {
const std::string pattern_name = "delete_quantdequant_op_pattern";
const std::string pattern_name = "delete_quant_dequant_op_pattern";
FusePassBase::Init(pattern_name, graph);
GraphPatternDetector gpd;

std::string quantdequant_types =
std::string quant_dequant_types =
"fake_quantize_dequantize_moving_average_abs_max";

auto* input_node = gpd.mutable_pattern()
->NewNode("input_node")
->assert_is_op_input(quantdequant_types, "X")
->assert_is_op_input(quant_dequant_types, "X")
->AsInput();

patterns::DeleteQuantDequantOpPattern pattern(gpd.mutable_pattern(),
pattern_name);
pattern(input_node, quantdequant_types);
pattern(input_node, quant_dequant_types);
auto* scope = param_scope();
int found_count = 0;

Expand Down
10 changes: 5 additions & 5 deletions paddle/fluid/framework/ir/graph_pattern_detector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3519,22 +3519,22 @@ void patterns::ShuffleChannelPattern::operator()(PDNode *reshape1_in) {
}

void patterns::DeleteQuantDequantOpPattern::operator()(
PDNode *input_node, const std::string &quantdequant_types) {
PDNode *input_node, const std::string &quant_dequant_types) {
auto quant_dequant_op_inscale =
pattern->NewNode(quant_dequant_op_inscale_repr())
->assert_is_op_input(quantdequant_types, "InScale")
->assert_is_op_input(quant_dequant_types, "InScale")
->AsInput();
auto quant_dequant_op = pattern->NewNode(quant_dequant_op_repr())
->assert_is_op(quantdequant_types);
->assert_is_op(quant_dequant_types);

auto quant_dequant_op_out =
pattern->NewNode(quant_dequant_op_out_repr())
->assert_is_op_output(quantdequant_types, "Out")
->assert_is_op_output(quant_dequant_types, "Out")
->AsOutput();

auto quant_dequant_op_outscale =
pattern->NewNode(quant_dequant_op_outscale_repr())
->assert_is_op_output(quantdequant_types, "OutScale")
->assert_is_op_output(quant_dequant_types, "OutScale")
->AsOutput();

quant_dequant_op->LinksFrom({quant_dequant_op_inscale, input_node});
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/framework/ir/graph_pattern_detector.h
Original file line number Diff line number Diff line change
Expand Up @@ -1869,9 +1869,9 @@ struct DeleteDropoutOpPattern : public PatternBase {

struct DeleteQuantDequantOpPattern : public PatternBase {
DeleteQuantDequantOpPattern(PDPattern* pattern, const std::string& name_scope)
: PatternBase(pattern, name_scope, "delete_quantdequant_op_pattern") {}
: PatternBase(pattern, name_scope, "delete_quant_dequant_op_pattern") {}

void operator()(PDNode* input_node, const std::string& quantdequant_types);
void operator()(PDNode* input_node, const std::string& quant_dequant_types);

PATTERN_DECL_NODE(quant_dequant_op_inscale);
PATTERN_DECL_NODE(quant_dequant_op);
Expand All @@ -1883,7 +1883,7 @@ struct DeleteQuantDequantFilterOpPattern : public PatternBase {
DeleteQuantDequantFilterOpPattern(PDPattern* pattern,
const std::string& name_scope)
: PatternBase(
pattern, name_scope, "delete_quantdequant_filter_op_pattern") {}
pattern, name_scope, "delete_quant_dequant_filter_op_pattern") {}

void operator()();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ TrtDeleteWeightQuantDequantLinearOpPass::
void TrtDeleteWeightQuantDequantLinearOpPass::ApplyImpl(
ir::Graph* graph) const {
const std::string pattern_name =
"delete_weight_quantdequant_linear_op_pattern";
"delete_weight_quant_dequant_linear_op_pattern";
FusePassBase::Init(pattern_name, graph);

GraphPatternDetector gpd;
Expand Down