提交 b871641a 编写于 作者: D dongzhihong

"switch to shared_ptr"

上级 18e65b0c
...@@ -11,7 +11,7 @@ void PlainNet::InferShape(Scope* scope) { ...@@ -11,7 +11,7 @@ void PlainNet::InferShape(Scope* scope) {
} }
} }
void PlainNet::Run(Scope* scope, DeviceContext* ctx) { void PlainNet::Run(std::shared_ptr<Scope> scope, DeviceContext* ctx) {
for (auto& op : ops_) { for (auto& op : ops_) {
op.Run(ctx); op.Run(ctx);
} }
......
...@@ -69,7 +69,7 @@ class Net { ...@@ -69,7 +69,7 @@ class Net {
* environment for ops. `begin` and `end` specify the scope of `ops_` to run, * environment for ops. `begin` and `end` specify the scope of `ops_` to run,
* If no positive indexes are provided, all operators in `ops_` will run. * If no positive indexes are provided, all operators in `ops_` will run.
*/ */
virtual void Run(Scope *scope, DeviceContext *ctx) = 0; virtual void Run(std::shared_ptr<Scope> scope, DeviceContext *ctx) = 0;
/** /**
* @brief Add an Operator according to `def`. * @brief Add an Operator according to `def`.
...@@ -123,7 +123,7 @@ class PlainNet : public Net { ...@@ -123,7 +123,7 @@ class PlainNet : public Net {
* scope will be used instead. If no OpContext is provicded, default context * scope will be used instead. If no OpContext is provicded, default context
* will be used. * will be used.
*/ */
virtual void Run(Scope *scope, DeviceContext *ctx) override; virtual void Run(std::shared_ptr<Scope> scope, DeviceContext *ctx) override;
/** /**
* @brief Add an operator to this network. * @brief Add an operator to this network.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册