提交 7781297c 编写于 作者: X Xin Pan

variants

上级 fcda23a3
......@@ -18,6 +18,7 @@
#include <unordered_set>
#include <utility>
#include "paddle/fluid/framework/ir/node.h"
#include "paddle/fluid/platform/place.h"
namespace paddle {
......
......@@ -14,6 +14,25 @@ limitations under the License. */
#pragma once
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "paddle/fluid/framework/ir/node.h"
#include "paddle/fluid/platform/variant.h"
namespace paddle {
namespace framework {} // namespace framework
namespace framework {
class Graph {
public:
std::map<std::string, std::vector<boost::any>> attrs;
std::vector<Node *> inputs;
std::vector<Node *> outputs;
std::vector<std::unique_ptr<Node>> nodes;
};
} // namespace framework
} // namespace paddle
......@@ -15,9 +15,11 @@ limitations under the License. */
#pragma once
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include "paddle/fluid/platform/macros.h"
#include "paddle/fluid/platform/variant.h"
namespace paddle {
namespace framework {
......@@ -29,11 +31,6 @@ class Node {
Node() {}
virtual ~Node() {}
template <typename Subclass>
Subclass &As() {
return *dynamic_cast<Subclass *>(this);
}
int64_t ID() const { return id_; }
std::string Name() const { return name_; }
......@@ -42,12 +39,15 @@ class Node {
return Name() + "(" + std::to_string(ID()) + ")";
}
virtual std::string DebugString() const = 0;
Type NodeType() const { return type_; }
std::vector<Node *> inputs;
std::vector<Node *> outputs;
protected:
std::map<std::string, std::vector<boost::any>> attrs_;
int64_t id_ = 0;
std::string name_;
Type type_;
......
......@@ -38,6 +38,7 @@ limitations under the License. */
#endif
#endif
#include <boost/any.hpp>
#include <boost/mpl/comparison.hpp>
#include <boost/mpl/less_equal.hpp>
#include <boost/variant.hpp>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册