diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index bd5f45bba93b560044acbd02583ed4cd4c0f96e4..0a4ee4ef28bea5d2e1b0c488f3d319ae77c43bed 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -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",