diff --git a/paddle/fluid/ir/dialect/pd_attribute.cc b/paddle/fluid/ir/dialect/pd_attribute.cc index 78a71013b87b534efde9c7593c9a9cab01191415..687e836dc70f30753b36a5d152b99ae23fa553de 100644 --- a/paddle/fluid/ir/dialect/pd_attribute.cc +++ b/paddle/fluid/ir/dialect/pd_attribute.cc @@ -16,7 +16,9 @@ namespace paddle { namespace dialect { -phi::IntArray IntArrayAttribute::data() const { return storage()->GetAsKey(); } +const phi::IntArray& IntArrayAttribute::data() const { + return storage()->GetAsKey(); +} phi::DataType DataTypeAttribute::data() const { return storage()->GetAsKey(); } diff --git a/paddle/fluid/ir/dialect/pd_attribute.h b/paddle/fluid/ir/dialect/pd_attribute.h index 7d921ebd1df1b8f28fb35b1508c3b72681f4265e..5af73b2c0f48b5e78d762ebad0ec69f630e69735 100644 --- a/paddle/fluid/ir/dialect/pd_attribute.h +++ b/paddle/fluid/ir/dialect/pd_attribute.h @@ -33,7 +33,7 @@ class IntArrayAttribute : public ir::Attribute { return storage() < right.storage(); } - phi::IntArray data() const; + const phi::IntArray &data() const; }; class ScalarAttribute : public ir::Attribute { diff --git a/paddle/fluid/ir/dialect/pd_attribute_storage.h b/paddle/fluid/ir/dialect/pd_attribute_storage.h index 78bf9beb089d77e6542b2629f37baea65a22235e..1877e5043fc651c091e19492276565a26c05c094 100644 --- a/paddle/fluid/ir/dialect/pd_attribute_storage.h +++ b/paddle/fluid/ir/dialect/pd_attribute_storage.h @@ -48,7 +48,7 @@ struct IntArrayAttributeStorage : public ir::AttributeStorage { (data_.FromTensor() == key.FromTensor()); } - ParamKey GetAsKey() const { return ParamKey(data_); } + const ParamKey &GetAsKey() const { return data_; } private: phi::IntArray data_;