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][task 337] reformat example code with google style in python/paddle/base/framework.py #57151

Merged
merged 6 commits into from
Sep 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions python/paddle/base/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,13 +1007,13 @@ def name_scope(prefix=None):
... a = paddle.static.data(name='data', shape=[None, 1], dtype='int32')
... b = a + paddle.to_tensor(1)
... with paddle.static.name_scope("s2"):
... c = b * 1
... c = b * paddle.to_tensor(1)
... with paddle.static.name_scope("s3"):
... d = c / 1
... d = c / paddle.to_tensor(1)
>>> with paddle.static.name_scope("s1"):
... f = paddle.tensor.pow(d, 2.0)
Copy link
Member

Choose a reason for hiding this comment

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

这个也要 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

😊是的,新的改好啦~

>>> with paddle.static.name_scope("s4"):
... g = f - 1
... g = f - paddle.to_tensor(1)

>>> # Op are created in the default main program.
>>> for op in paddle.static.default_main_program().block(0).ops:
Expand Down Expand Up @@ -7537,9 +7537,10 @@ def default_main_program():
>>> y = paddle.static.data(name='y', shape=[100, 100], dtype='float32')
>>> out = paddle.add(x, y)

>>> #print the number of blocks in the program, 1 in this case
>>> print(paddle.static.default_main_program().num_blocks) # 1
>>> #print the default_main_program
>>> # print the number of blocks in the program, 1 in this case
>>> print(paddle.static.default_main_program().num_blocks)
1
>>> # print the default_main_program
>>> print(paddle.static.default_main_program())
"""
return _main_program_
Expand Down