diff --git a/paddle/fluid/framework/attribute.cc b/paddle/fluid/framework/attribute.cc index ed50d5f6bfc4fc6843b1e92d92f24d8b7a182036..a2d0f2db2829d0cdb982397a9bd6245e1efdedf1 100644 --- a/paddle/fluid/framework/attribute.cc +++ b/paddle/fluid/framework/attribute.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "paddle/fluid/framework/attribute.h" -#include "boost/blank.hpp" +#include "paddle/utils/blank.h" namespace paddle { namespace framework { @@ -118,7 +118,7 @@ Attribute GetAttrValue(const proto::OpDesc::Attr& attr_desc) { PADDLE_THROW(platform::errors::Unavailable("Unsupport attribute type %d.", attr_desc.type())); } - return boost::blank(); + return paddle::blank(); } } // namespace framework diff --git a/paddle/fluid/framework/ir/generate_pass.cc b/paddle/fluid/framework/ir/generate_pass.cc index 83c3ab9933d61169d73c5a3c50628fdd91d3c6af..160304784a9fa69d3248f773cf48a90470ffd3f2 100644 --- a/paddle/fluid/framework/ir/generate_pass.cc +++ b/paddle/fluid/framework/ir/generate_pass.cc @@ -14,8 +14,8 @@ #include "paddle/fluid/framework/ir/generate_pass.h" -#include "boost/blank.hpp" #include "paddle/fluid/framework/ir/graph_pattern_detector.h" +#include "paddle/utils/blank.h" namespace paddle { namespace framework { @@ -40,7 +40,7 @@ class element_visitor : public boost::static_visitor { if (index >= 0 && static_cast(index) < attr.size()) { return static_cast(attr[index]); } - return boost::blank(); + return paddle::blank(); } private: @@ -99,7 +99,7 @@ Attribute GetVarAttrValue(const VarDesc* desc, return shape; } } - return boost::blank(); + return paddle::blank(); } Attribute GetOpAttrValue(const OpDesc* desc, diff --git a/paddle/fluid/framework/op_desc.cc b/paddle/fluid/framework/op_desc.cc index c8a9950ae5efb6f39a2ac99d041c0d6e2a35c620..169722b971b29fc97b41040b69810dc9c7bb0e37 100644 --- a/paddle/fluid/framework/op_desc.cc +++ b/paddle/fluid/framework/op_desc.cc @@ -16,7 +16,6 @@ limitations under the License. */ #include -#include "boost/blank.hpp" #include "glog/logging.h" #include "paddle/fluid/framework/block_desc.h" #include "paddle/fluid/framework/op_call_stack.h" @@ -24,6 +23,7 @@ limitations under the License. */ #include "paddle/fluid/framework/operator.h" #include "paddle/fluid/framework/shape_inference.h" #include "paddle/fluid/framework/var_type_inference.h" +#include "paddle/utils/blank.h" namespace paddle { namespace framework { @@ -810,7 +810,7 @@ struct SetAttrDescVisitor : public boost::static_visitor { VectorToRepeated(v, attr_->mutable_float64s()); } - void operator()(boost::blank) const { + void operator()(paddle::blank) const { PADDLE_THROW(platform::errors::Unavailable( "Unsupported calling method of SetAttrDescVisitor object for " "`boosst::blank` type.")); diff --git a/paddle/fluid/framework/type_defs.h b/paddle/fluid/framework/type_defs.h index ca9d6ec44a8d9e1a342ad0716f05d36657af0efa..5c768b10a3d7e70270cad2e8d438cd319d0aef14 100644 --- a/paddle/fluid/framework/type_defs.h +++ b/paddle/fluid/framework/type_defs.h @@ -22,9 +22,9 @@ limitations under the License. */ #include #include -#include "boost/blank.hpp" #include "paddle/fluid/imperative/type_defs.h" #include "paddle/fluid/platform/variant.h" +#include "paddle/utils/blank.h" #include "paddle/utils/small_vector.h" #include "paddle/utils/variant.h" @@ -42,7 +42,7 @@ class InferNoNeedBufferVarsFN; using VariableNameMap = std::map>; using VariableValueMap = std::map>; -using Attribute = paddle::variant; #ifdef PADDLE_WITH_ASCEND_CL -using NPUAttribute = paddle::variant #include -#include "boost/blank.hpp" +#include "paddle/utils/blank.h" #include "paddle/fluid/framework/ir/graph_helper.h" #include "paddle/fluid/platform/device/ipu/ipu_names.h" @@ -75,9 +75,9 @@ struct CustomOpAttrVisitor : public boost::static_visitor { void operator()(const std::vector& v) const { attrs_->emplace(attr_name_, v); } - void operator()(boost::blank) const { + void operator()(paddle::blank) const { PADDLE_THROW(platform::errors::Unavailable( - "Unsupported calling method for `boost::blank` type when extracting " + "Unsupported calling method for `paddle::blank` type when extracting " "custom operator attributes.")); } }; @@ -124,7 +124,7 @@ struct ConstantOpAttrVisitor : public boost::static_visitor { void operator()(BlockDesc* desc) const { RAISE_ERROR; } void operator()(const std::vector& v) const { RAISE_ERROR; } void operator()(int64_t v) const { RAISE_ERROR; } - void operator()(boost::blank) const { RAISE_ERROR; } + void operator()(paddle::blank) const { RAISE_ERROR; } #undef RAISE_ERROR }; diff --git a/paddle/phi/api/ext/op_meta_info.h b/paddle/phi/api/ext/op_meta_info.h index fa19714dde7dba98d24b33c25ff07617f0d934a5..546b0accf8ba7e41b71f672807257ffa783de0c2 100644 --- a/paddle/phi/api/ext/op_meta_info.h +++ b/paddle/phi/api/ext/op_meta_info.h @@ -213,7 +213,7 @@ struct KernelFuncImpl { PD_SPECIALIZE_ComputeCallHelper(const std::vector&); // TODO(chenweihang): support other attribute type if needed. // Why not support other attribute type here? - // - boost::blank, std::vector and std::vector + // - paddle::blank, std::vector and std::vector // are not used in op // - BlockDesc* and std::vector are used in framework diff --git a/paddle/phi/core/enforce.cc b/paddle/phi/core/enforce.cc index 0dd415d13130ea0071a55fb190b31ed643af94d3..8074fbeb4918043e121503626eb4120cb13c7c0c 100644 --- a/paddle/phi/core/enforce.cc +++ b/paddle/phi/core/enforce.cc @@ -14,13 +14,12 @@ limitations under the License. */ #include "paddle/phi/core/enforce.h" -#include #include #include #include #include -#include "boost/blank.hpp" +#include "paddle/utils/blank.h" #include "paddle/utils/variant.h" namespace egr { @@ -29,7 +28,7 @@ class EagerVariable; namespace paddle { namespace framework { class BlockDesc; -using Attribute = paddle::variant=(const blank&, const blank&) { return true; } + +inline bool operator!=(const blank&, const blank&) { return false; } + +inline bool operator<(const blank&, const blank&) { return false; } + +inline bool operator>(const blank&, const blank&) { return false; } + +} // namespace paddle