Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xdoctest] reformat example code with google style in No.339-No.343 #57087

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

longranger2
Copy link
Contributor

PR types

Others

PR changes

Others

Description

修改如下文件的示例代码为新的格式,并通过 xdoctest 检查:

  • python/paddle/fluid/io.py
  • python/paddle/fluid/layer_helper_base.py
  • python/paddle/fluid/layers/control_flow.py
  • python/paddle/fluid/layers/learning_rate_scheduler.py
  • python/paddle/fluid/layers/math_op_patch.py

其中:

  • io.py没有涉及到sample code;
  • python/paddle/fluid/layers/control_flow.py 已经被迁移到 python/paddle/static/nn/control_flow.py;
  • learning_rate_scheduler.py已经被删除

@sunzhongkai588 @SigureMo @megemini


@paddle-bot
Copy link

paddle-bot bot commented Sep 7, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

>>> import paddle
>>> import paddle.base as base
>>> paddle.enable_static()
>>> startup_prog = base.Program()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

能不用(原)fluid 就不用

  • Program -> paddle.static.Program

>>> x = paddle.static.data(name='x', shape=[3, 2, 1])
>>> # print the dimension of the Variable
>>> print(x.ndimension())
<bound method monkey_patch_variable.<locals>.<lambda> of var x : LOD_TENSOR.shape(3, 2, 1).dtype(float32).stop_gradient(True)>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

都加 () 了还是 method 么?需要确认下

>>> x = paddle.static.data(name='x', shape=[3, 2, 1])
>>> # print the dimension of the Variable
>>> print(x.dim())
<bound method monkey_patch_variable.<locals>.<lambda> of var x : LOD_TENSOR.shape(3, 2, 1).dtype(float32).stop_gradient(True)>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Sep 8, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTMeow 🐾

@luotao1 luotao1 merged commit fd39b73 into PaddlePaddle:develop Sep 11, 2023
25 of 27 checks passed
@longranger2 longranger2 deleted the xdoctest5 branch September 13, 2023 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants