@@ -31,30 +31,30 @@ The block is hierarchical because PaddlePaddle supports RNN and IfElse. For exam
```python
classBlock(objects):
def__init__(self,parent=None):
self.vars=map<string,Variable>()
self.ops=vector<Operator>()
self.parent=parent
defcreate_var(self,...):
# create variable in `self.vars`
returnVariable(...)
defcreate_global_var(self,...):
ifself.parentisnotNone:
returnself.parent.create_global_var(...)
else:
returnself.create_var(...)
defcreate_parameter(self,...):
returnself.create_global_var(...)
defappend_operator(self,...):
self.ops.append(...)
defprepend_operator(self,...):
self.ops.prepend(...)
def__init__(self,parent=None):
self.vars=map<string,Variable>()
self.ops=vector<Operator>()
self.parent=parent
defcreate_var(self,...):
# create variable in `self.vars`
returnVariable(...)
defcreate_global_var(self,...):
ifself.parentisnotNone:
returnself.parent.create_global_var(...)
else:
returnself.create_var(...)
defcreate_parameter(self,...):
returnself.create_global_var(...)
defappend_operator(self,...):
self.ops.append(...)
defprepend_operator(self,...):
self.ops.prepend(...)
```
Users are able to create a global variable inside any block since they many create parameters inside a RNN or IfElseOp. All parameters should be stored in the global block, not the step block in RNN.
...
...
@@ -68,14 +68,14 @@ Operator class will take inputs, outputs and attributes of the operator into `pr