提交 1ac0bffa 编写于 作者: Y Yu Yang

Override Net::DebugString to invoke inner ops_

Net::DebugString() print what it is and invokes inner operators
DebugString() with a prefix '\t'.
上级 a33e9da9
...@@ -55,5 +55,14 @@ void PlainNet::CompleteAddOp() { ...@@ -55,5 +55,14 @@ void PlainNet::CompleteAddOp() {
add_op_done_ = true; add_op_done_ = true;
} }
std::string PlainNet::DebugString() const {
std::ostringstream os;
os << this->type_ << ":" << std::endl;
for (auto& op : ops_) {
os << "\t" << op->DebugString() << std::endl;
}
return os.str();
}
} // namespace framework } // namespace framework
} // namespace paddle } // namespace paddle
...@@ -88,6 +88,8 @@ class PlainNet : public Net { ...@@ -88,6 +88,8 @@ class PlainNet : public Net {
void CompleteAddOp() override; void CompleteAddOp() override;
std::string DebugString() const override;
std::vector<OperatorPtr> ops_; std::vector<OperatorPtr> ops_;
private: private:
......
...@@ -48,7 +48,7 @@ class OperatorBase { ...@@ -48,7 +48,7 @@ class OperatorBase {
return boost::get<T>(attrs_.at(name)); return boost::get<T>(attrs_.at(name));
} }
std::string DebugString() const; virtual std::string DebugString() const;
/// Init will be called after CreateOperator, you can put some initialization /// Init will be called after CreateOperator, you can put some initialization
/// logic here. /// logic here.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册