From 2b8e62859b8f83d646c6a53c3572f88440cdc0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=98=A5=E4=B9=94?= <83450930+Liyulingyue@users.noreply.github.com> Date: Mon, 24 Jul 2023 08:26:53 +0800 Subject: [PATCH] =?UTF-8?q?[IR=20Dialect]=20=E2=9A=94Elden=20chapter=201.1?= =?UTF-8?q?=E2=9A=94=20=20(#55525)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IntArrayAttributeStorage --- paddle/fluid/ir/dialect/pd_attribute.cc | 4 +++- paddle/fluid/ir/dialect/pd_attribute.h | 2 +- paddle/fluid/ir/dialect/pd_attribute_storage.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/ir/dialect/pd_attribute.cc b/paddle/fluid/ir/dialect/pd_attribute.cc index 78a71013b87..687e836dc70 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 7d921ebd1df..5af73b2c0f4 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 78bf9beb089..1877e5043fc 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_; -- GitLab