You need to specify a scope to run a Net. One net can run in different scopes and update different variable in the scope. If you did not specify one, It will run in a default scope.
解释下Scope如何被共享,如何查找Variable的算法。
* Scope永远从本地寻找Variable,找不到会从他的父亲Scope寻找Variable
* 嵌套深度不做要求。
```cpp
# 接口实现
Scopeglobal;
autox=newVar("X");// x is created in scope global, implicitly.
autoy=newVar("Y");
Netnet1;
net1.addOp("add",{x,y},{x});// x = x + y;
net1.run();
for(size_ti=0;i<10;++i){
C++ code.
Scopelocal;
autotmp=newVar("tmp");// tmp is created in scope local.
Netnet2;
net2.addOp("add",{x,y},{tmp});
net2.run();// tmp = x + y;
}
Netnet3;
net3.addOp("add",{x,y},{"tmp"});// error! cannot found "tmp" in global scope.
```
## 各个接口是啥意思,为啥这么设计
### Chain structure
Scope has a pointer point to it's parent scope, this is mainly used in RNN when it need to create many stepNet.