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. 301 #56599

Merged
merged 8 commits into from
Sep 5, 2023

Conversation

Liyulingyue
Copy link
Contributor

PR types

Others

PR changes

Others

Description

#55629

@paddle-bot paddle-bot bot added the contributor External developers label Aug 23, 2023
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 24, 2023
... return image, label
... def __len__(self):
... return self.num_samples

Copy link
Member

Choose a reason for hiding this comment

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

不要直接空行,用 ...,不然会认为是两段代码,下同

python/paddle/incubate/optimizer/modelaverage.py Outdated Show resolved Hide resolved
python/paddle/incubate/optimizer/modelaverage.py Outdated Show resolved Hide resolved
python/paddle/incubate/optimizer/modelaverage.py Outdated Show resolved Hide resolved
python/paddle/incubate/optimizer/modelaverage.py Outdated Show resolved Hide resolved
python/paddle/incubate/optimizer/modelaverage.py Outdated Show resolved Hide resolved

sgd = paddle.optimizer.SGD(learning_rate=0.1,parameters=linear.parameters())
>>> sgd = paddle.optimizer.SGD(learning_rate=0.1,parameters=linear.parameters())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change

... min_average_window=2,
... max_average_window=4)
>>> sgd.step()
>>> modelaverage.step()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change

print(param)
>>> with modelaverage.apply(need_restore=False):
... for param in linear.parameters():
... print(param)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change

for param in linear.parameters():
print(param)
>>> for param in linear.parameters():
... print(param)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change


modelaverage.restore()
>>> modelaverage.restore()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change

@luotao1 luotao1 merged commit bb078c1 into PaddlePaddle:develop Sep 5, 2023
@luotao1
Copy link
Contributor

luotao1 commented Sep 5, 2023

@yuchen202 你认领的301,张师傅已经做完了,请不要做重复了

@yuchen202
Copy link
Contributor

@yuchen202 你认领的301,张师傅已经做完了,请不要做重复了

噢噢,我把我那个py文件删了

BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…Paddle#56599)

* Update private_helper_function.py

* xdoc

* Apply suggestions from code review

* format and skip a to_static case

* add a missing space

---------

Co-authored-by: SigureMo <sigure.qaq@gmail.com>
@Liyulingyue Liyulingyue deleted the xdoc8 branch September 23, 2023 16:09
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.

5 participants