Skip to content

Commit

Permalink
[IR] Refine Int64 attribute translator logic (#56842)
Browse files Browse the repository at this point in the history
* fix bug

* fix bug
  • Loading branch information
zhangbo9674 authored Sep 1, 2023
1 parent 0d08135 commit 84ec809
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions paddle/fluid/ir_adaptor/translator/attribute_translator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ class Int64ArrayAttributeVisitor : public AttributeVisitor {
}
};

class Int64AttributeVisitor : public AttributeVisitor {
public:
using AttributeVisitor::AttributeVisitor;

ir::Attribute operator()(int is) override {
VLOG(10) << "translating int to Int64Attribute";
return ir::Int64Attribute::get(ctx, is);
}
};

class IntArrayAttributeVisitor : public AttributeVisitor {
public:
using AttributeVisitor::AttributeVisitor;
Expand Down Expand Up @@ -229,6 +239,7 @@ AttributeTranslator::AttributeTranslator() {
new PlaceAttributeVisitor();
special_visitors["ir::ArrayAttribute<ir::Int64Attribute>"] =
new Int64ArrayAttributeVisitor();
special_visitors["ir::Int64Attribute"] = new Int64AttributeVisitor();
}

ir::Attribute AttributeTranslator::operator()(
Expand Down

0 comments on commit 84ec809

Please sign in to comment.