@@ -425,7 +425,7 @@ class Variable(object):
425
425
.. code-block:: python
426
426
427
427
import paddle.fluid as fluid
428
- cur_program = Program()
428
+ cur_program = fluid. Program()
429
429
cur_block = cur_program.current_block()
430
430
new_variable = cur_block.create_var(name="X",
431
431
shape=[-1, 23, 48],
@@ -617,6 +617,17 @@ def to_string(self, throw_on_error, with_details=False):
617
617
618
618
Returns:
619
619
str: The debug string.
620
+
621
+ Examples:
622
+ .. code-block:: python
623
+
624
+ import paddle.fluid as fluid
625
+ cur_program = fluid.Program()
626
+ cur_block = cur_program.current_block()
627
+ new_variable = cur_block.create_var(name="X",
628
+ shape=[-1, 23, 48],
629
+ dtype='float32')
630
+ new_variable.to_string(True)
620
631
"""
621
632
if in_dygraph_mode ():
622
633
# TODO(panyx0718): add more dygraph debug info.
@@ -642,18 +653,6 @@ def to_string(self, throw_on_error, with_details=False):
642
653
643
654
__repr__ = __str__
644
655
645
- def set_desc (self , input ):
646
- """
647
- Set the variable description.
648
-
649
- Args:
650
- input(core.VarDesc): The new VarDesc.
651
-
652
- Returns:
653
- None
654
- """
655
- self .desc = input
656
-
657
656
@property
658
657
def stop_gradient (self ):
659
658
if in_dygraph_mode ():
@@ -1067,7 +1066,7 @@ class Operator(object):
1067
1066
.. code-block:: python
1068
1067
1069
1068
import paddle.fluid as fluid
1070
- cur_program = Program()
1069
+ cur_program = fluid. Program()
1071
1070
cur_block = cur_program.current_block()
1072
1071
# var1 += var2 + var3
1073
1072
cur_block.append_op(type="sum",
0 commit comments