提交 ad728419 编写于 作者: Y Yu Yang 提交者: GitHub

Merge pull request #2912 from reyoung/feature/better_network_debug_str

Override Net::DebugString to invoke inner ops_
...@@ -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:
......
...@@ -72,7 +72,7 @@ class OperatorBase { ...@@ -72,7 +72,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.
先完成此消息的编辑!
想要评论请 注册