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

Method create_var_node

python/paddle/base/framework.py:5693–5712  ·  view source on GitHub ↗

Create a variable node in the graph. The created variable node is not persistable. Args: name(str): the name of the variable node. var_type(core.VarDesc.VarType): the type of the variable node. shape(list): the shape of the variable node.

(self, name, var_type, shape, var_dtype)

Source from the content-addressed store, hash-verified

5691 return IrVarNode(self.graph.create_var_node(var_desc))
5692
5693 def create_var_node(self, name, var_type, shape, var_dtype):
5694 """
5695 Create a variable node in the graph. The created variable node is
5696 not persistable.
5697
5698 Args:
5699 name(str): the name of the variable node.
5700 var_type(core.VarDesc.VarType): the type of the variable node.
5701 shape(list): the shape of the variable node.
5702 var_dtype(core.VarDesc.VarType): the data type of the variable node.
5703
5704 Returns:
5705 IrVarNode: the created variable node.
5706 """
5707
5708 var_desc = core.VarDesc(name)
5709 var_desc.set_type(var_type)
5710 var_desc.set_shape(shape)
5711 var_desc.set_dtype(var_dtype)
5712 return IrVarNode(self.graph.create_var_node(var_desc))
5713
5714 def create_control_dep_var(self):
5715 """

Calls 5

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

Tested by 1

test_create_var_nodeMethod · 0.64