Create a persistable variable node in the graph. In IrGraph, it can not distinguish between persistable variables and parameters. Args: name(str): the name of the persistable variable node. var_type(core.VarDesc.VarType): the type of the persistable
(self, name, var_type, shape, var_dtype)
| 5670 | return IrGraph(self.graph.get_sub_graph(i), for_test=for_test) |
| 5671 | |
| 5672 | def create_persistable_node(self, name, var_type, shape, var_dtype): |
| 5673 | """ |
| 5674 | Create a persistable variable node in the graph. In IrGraph, |
| 5675 | it can not distinguish between persistable variables and parameters. |
| 5676 | |
| 5677 | Args: |
| 5678 | name(str): the name of the persistable variable node. |
| 5679 | var_type(core.VarDesc.VarType): the type of the persistable variable node. |
| 5680 | shape(list): the shape of the persistable variable node. |
| 5681 | var_dtype(core.VarDesc.VarType): the data type of the persistable variable node. |
| 5682 | |
| 5683 | Returns: |
| 5684 | IrVarNode: the created persistable variable node. |
| 5685 | """ |
| 5686 | var_desc = core.VarDesc(name) |
| 5687 | var_desc.set_type(var_type) |
| 5688 | var_desc.set_shape(shape) |
| 5689 | var_desc.set_dtype(var_dtype) |
| 5690 | var_desc.set_persistable(True) |
| 5691 | return IrVarNode(self.graph.create_var_node(var_desc)) |
| 5692 | |
| 5693 | def create_var_node(self, name, var_type, shape, var_dtype): |
| 5694 | """ |
no test coverage detected