MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / create_persistable_node

Method create_persistable_node

python/paddle/base/framework.py:5672–5691  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Calls 6

IrVarNodeClass · 0.85
create_var_nodeMethod · 0.80
VarDescMethod · 0.45
set_typeMethod · 0.45
set_shapeMethod · 0.45
set_dtypeMethod · 0.45

Tested by

no test coverage detected