@@ -99,7 +97,7 @@ To ensure `only scope can create a variable`, we should mark `Variable`'s constr
...
@@ -99,7 +97,7 @@ To ensure `only scope can create a variable`, we should mark `Variable`'s constr
## When scope destroyed, all variables inside this scope should be destroyed together
## When scope destroyed, all variables inside this scope should be destroyed together
The `VariablePtr` is a `weak_ptr`. `Net` and `Op` can only get a Variable from `Scope`, but cannot hold it. When scope is destroyed, all `VariablePtr`s belong to this Scope will be changed to `nullptr`.
The scope hold unique pointers for all variables. User can `GetVariable` from scope, but he should not hold this pointer as a member variable. Because when scope is destroyed, all variables inside this scope will be destroyed together.