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
4 changes: 2 additions & 2 deletions paddle/fluid/framework/attribute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/framework/ir/generate_pass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -40,7 +40,7 @@ class element_visitor : public boost::static_visitor<Attribute> {
if (index >= 0 && static_cast<size_t>(index) < attr.size()) {
return static_cast<ET>(attr[index]);
}
return boost::blank();
return paddle::blank();
}

private:
Expand Down Expand Up @@ -99,7 +99,7 @@ Attribute GetVarAttrValue(const VarDesc* desc,
return shape;
}
}
return boost::blank();
return paddle::blank();
}

Attribute GetOpAttrValue(const OpDesc* desc,
Expand Down
4 changes: 2 additions & 2 deletions paddle/fluid/framework/op_desc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ limitations under the License. */

#include <string>

#include "boost/blank.hpp"
#include "glog/logging.h"
#include "paddle/fluid/framework/block_desc.h"
#include "paddle/fluid/framework/op_call_stack.h"
#include "paddle/fluid/framework/op_proto_maker.h"
#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 {
Expand Down Expand Up @@ -810,7 +810,7 @@ struct SetAttrDescVisitor : public boost::static_visitor<void> {
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."));
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/framework/type_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ limitations under the License. */
#include <unordered_set>
#include <vector>

#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"

Expand All @@ -42,7 +42,7 @@ class InferNoNeedBufferVarsFN;
using VariableNameMap = std::map<std::string, std::vector<std::string>>;
using VariableValueMap = std::map<std::string, std::vector<Variable*>>;

using Attribute = paddle::variant<boost::blank,
using Attribute = paddle::variant<paddle::blank,
int,
float,
std::string,
Expand All @@ -59,7 +59,7 @@ using Attribute = paddle::variant<boost::blank,
using AttributeMap = std::unordered_map<std::string, Attribute>;

#ifdef PADDLE_WITH_ASCEND_CL
using NPUAttribute = paddle::variant<boost::blank,
using NPUAttribute = paddle::variant<paddle::blank,
int,
float,
std::string,
Expand Down
8 changes: 4 additions & 4 deletions paddle/fluid/platform/device/ipu/ipu_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <popart/optimizer.hpp>
#include <popart/sgd.hpp>

#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"
Expand Down Expand Up @@ -75,9 +75,9 @@ struct CustomOpAttrVisitor : public boost::static_visitor<void> {
void operator()(const std::vector<double>& 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."));
}
};
Expand Down Expand Up @@ -124,7 +124,7 @@ struct ConstantOpAttrVisitor : public boost::static_visitor<void> {
void operator()(BlockDesc* desc) const { RAISE_ERROR; }
void operator()(const std::vector<BlockDesc*>& 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
};

Expand Down
2 changes: 1 addition & 1 deletion paddle/phi/api/ext/op_meta_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ struct KernelFuncImpl<Return (*)(Args...), impl_fn> {
PD_SPECIALIZE_ComputeCallHelper(const std::vector<std::string>&);
// TODO(chenweihang): support other attribute type if needed.
// Why not support other attribute type here?
// - boost::blank, std::vector<bool> and std::vector<double>
// - paddle::blank, std::vector<bool> and std::vector<double>
// are not used in op
// - BlockDesc* and std::vector<BlockDesc*> are used in framework

Expand Down
5 changes: 2 additions & 3 deletions paddle/phi/core/enforce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ limitations under the License. */

#include "paddle/phi/core/enforce.h"

#include <boost/variant.hpp>
#include <map>
#include <memory>
#include <unordered_map>
#include <vector>

#include "boost/blank.hpp"
#include "paddle/utils/blank.h"
#include "paddle/utils/variant.h"

namespace egr {
Expand All @@ -29,7 +28,7 @@ class EagerVariable;
namespace paddle {
namespace framework {
class BlockDesc;
using Attribute = paddle::variant<boost::blank,
using Attribute = paddle::variant<paddle::blank,
int,
float,
std::string,
Expand Down
52 changes: 52 additions & 0 deletions paddle/utils/blank.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

// This file copy from boost/blank.hpp, boost version: 1.41.0
// Modified the following points:
// 1. modify namespace from boost to paddle
// 2. remove the depending boost header files
// 3. remove the type traits specializations
// 4. remove streaming support

//-----------------------------------------------------------------------------
// boost blank.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2003
// Eric Friedman
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#pragma once

namespace paddle {

struct blank {};

inline bool operator==(const blank&, const blank&) { return true; }

inline bool operator<=(const blank&, const blank&) { return true; }

inline bool operator>=(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