未验证 提交 2729c174 编写于 作者: C chengduo 提交者: GitHub

Fix example error of Variable and Operator (#19821)

* fix example error
test=develop

* Remove set_desc
test=develop
上级 82814970
......@@ -425,7 +425,7 @@ class Variable(object):
.. code-block:: python
import paddle.fluid as fluid
cur_program = Program()
cur_program = fluid.Program()
cur_block = cur_program.current_block()
new_variable = cur_block.create_var(name="X",
shape=[-1, 23, 48],
......@@ -617,6 +617,17 @@ class Variable(object):
Returns:
str: The debug string.
Examples:
.. code-block:: python
import paddle.fluid as fluid
cur_program = fluid.Program()
cur_block = cur_program.current_block()
new_variable = cur_block.create_var(name="X",
shape=[-1, 23, 48],
dtype='float32')
new_variable.to_string(True)
"""
if in_dygraph_mode():
# TODO(panyx0718): add more dygraph debug info.
......@@ -642,18 +653,6 @@ class Variable(object):
__repr__ = __str__
def set_desc(self, input):
"""
Set the variable description.
Args:
input(core.VarDesc): The new VarDesc.
Returns:
None
"""
self.desc = input
@property
def stop_gradient(self):
if in_dygraph_mode():
......@@ -1067,7 +1066,7 @@ class Operator(object):
.. code-block:: python
import paddle.fluid as fluid
cur_program = Program()
cur_program = fluid.Program()
cur_block = cur_program.current_block()
# var1 += var2 + var3
cur_block.append_op(type="sum",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册