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 113] Reformat example code with google style in python/paddle/nn/layer/container.py #56229

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

Candy2Tang
Copy link
Contributor

@Candy2Tang Candy2Tang commented Aug 13, 2023

PR types

Others

PR changes

Docs

Description

对应tracking issue: #55629
预览链接:

  • en: 生成中...
  • zh: 生成中...

@paddle-bot
Copy link

paddle-bot bot commented Aug 13, 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.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Aug 13, 2023
@paddle-bot
Copy link

paddle-bot bot commented Aug 13, 2023

✅ This PR's description meets the template requirements!
Please wait for other CI results.

@Candy2Tang Candy2Tang changed the title [xdoctest][task 113] test=docs_preview [xdoctest][task 113] Reformat example code with google style in python/paddle/nn/layer/container.py Aug 13, 2023
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 14, 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.

有一些 print 结果的注释还没改成输出~

#3
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> len(layer_dict)
>>> #3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> #3
3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

#0
>>> layer_dict.clear()
>>> len(layer_dict)
>>> #0
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> #0
0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

Comment on lines 142 to 144
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> len(layer_dict)
>>> #3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> len(layer_dict)
>>> #3
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> len(layer_dict)
3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

Comment on lines 146 to 148
>>> layer_dict.pop('conv2d')
>>> len(layer_dict)
>>> #2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> layer_dict.pop('conv2d')
>>> len(layer_dict)
>>> #2
>>> layer_dict.pop('conv2d')
>>> len(layer_dict)
2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

Comment on lines 178 to 180
>>> #conv1d
>>> #conv2d
>>> #conv3d
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> #conv1d
>>> #conv2d
>>> #conv3d
conv1d
conv2d
conv3d

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

Comment on lines 204 to 210
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> for k, v in layer_dict.items():
... print(k, ":", v)
...
>>> #conv1d : Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #conv2d : Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
>>> #conv3d : Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> for k, v in layer_dict.items():
... print(k, ":", v)
...
>>> #conv1d : Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #conv2d : Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
>>> #conv3d : Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers)
>>> for k, v in layer_dict.items():
... print(f"{k}:", v)
...
conv1d: Conv1D(3, 2, kernel_size=[3], data_format=NCL)
conv2d: Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
conv3d: Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好哒,已修复~

Comment on lines 238 to 240
>>> #Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
>>> #Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> #Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
>>> #Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
Conv1D(3, 2, kernel_size=[3], data_format=NCL)
Conv2D(3, 2, kernel_size=[3, 3], data_format=NCHW)
Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)

Comment on lines 272 to 277
>>> for k, v in layer_dict.items():
... print(k, ":", v)
>>> #conv1d : Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #conv2d : Conv2D(4, 2, kernel_size=[4, 4], data_format=NCHW)
>>> #conv3d : Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
>>> #relu : ReLU()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
>>> for k, v in layer_dict.items():
... print(k, ":", v)
>>> #conv1d : Conv1D(3, 2, kernel_size=[3], data_format=NCL)
>>> #conv2d : Conv2D(4, 2, kernel_size=[4, 4], data_format=NCHW)
>>> #conv3d : Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
>>> #relu : ReLU()
>>> for k, v in layer_dict.items():
... print(f"{k}:", v)
conv1d: Conv1D(3, 2, kernel_size=[3], data_format=NCL)
conv2d: Conv2D(4, 2, kernel_size=[4, 4], data_format=NCHW)
conv3d: Conv3D(4, 6, kernel_size=[3, 3, 3], data_format=NCDHW)
relu: ReLU()

>>> x = paddle.uniform(shape=[5, 2], dtype='float32')
>>> num_stacked_param = 4
>>> model = MyLayer(num_stacked_param)
>>> print(len(model.params)) # 4
Copy link
Member

Choose a reason for hiding this comment

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

这些 print 要作为输出,后面还有一些也是要改的

Copy link
Contributor Author

Choose a reason for hiding this comment

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

均已修复

del layers_dict['conv2d']
len(layers_dict)
#2
>>> conv1d = layers_dict.pop('conv1d')
Copy link
Member

Choose a reason for hiding this comment

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

这里为什么不用原来的 del 呢?是有什么问题么

Copy link
Contributor

Choose a reason for hiding this comment

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

del 在上面,这里原来就是 pop ~~~ 别用 Unified review 了,用 Split 吧 ~

吃药 休息吧 ~ 哈哈哈哈 🤣

Copy link
Member

Choose a reason for hiding this comment

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

image

我这里是 split view,没对齐

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 🐾

del layers_dict['conv2d']
len(layers_dict)
#2
>>> conv1d = layers_dict.pop('conv1d')
Copy link
Member

Choose a reason for hiding this comment

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

image

我这里是 split view,没对齐

@luotao1 luotao1 merged commit 3615389 into PaddlePaddle:develop Aug 21, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
…n/paddle/nn/layer/container.py (PaddlePaddle#56229)

* [xdoctest][task 113] test=docs_preview

* test=document_fix

* test=document_fix
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