提交 fcda23a3 编写于 作者: X Xin Pan

simple node

上级 08acc035
......@@ -14,6 +14,46 @@ limitations under the License. */
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include "paddle/fluid/platform/macros.h"
namespace paddle {
namespace framework {} // namespace framework
namespace framework {
class Node {
public:
enum class Type { kNone = -1, kOperation, kVariable };
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_; }
virtual std::string ToString() const {
return Name() + "(" + std::to_string(ID()) + ")";
}
Type NodeType() const { return type_; }
std::vector<Node *> inputs;
std::vector<Node *> outputs;
protected:
int64_t id_ = 0;
std::string name_;
Type type_;
DISABLE_COPY_AND_ASSIGN(Node);
};
} // namespace framework
} // namespace paddle
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册