-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
✅ This PR's description meets the template requirements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有一些 print 结果的注释还没改成输出~
python/paddle/nn/layer/container.py
Outdated
#3 | ||
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers) | ||
>>> len(layer_dict) | ||
>>> #3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> #3 | |
3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
#0 | ||
>>> layer_dict.clear() | ||
>>> len(layer_dict) | ||
>>> #0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> #0 | |
0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers) | ||
>>> len(layer_dict) | ||
>>> #3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers) | |
>>> len(layer_dict) | |
>>> #3 | |
>>> layer_dict = paddle.nn.LayerDict(sublayers=sublayers) | |
>>> len(layer_dict) | |
3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
>>> layer_dict.pop('conv2d') | ||
>>> len(layer_dict) | ||
>>> #2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> layer_dict.pop('conv2d') | |
>>> len(layer_dict) | |
>>> #2 | |
>>> layer_dict.pop('conv2d') | |
>>> len(layer_dict) | |
2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
>>> #conv1d | ||
>>> #conv2d | ||
>>> #conv3d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> #conv1d | |
>>> #conv2d | |
>>> #conv3d | |
conv1d | |
conv2d | |
conv3d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
>>> 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好哒,已修复~
python/paddle/nn/layer/container.py
Outdated
>>> #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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> #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) |
python/paddle/nn/layer/container.py
Outdated
>>> 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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> 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() |
python/paddle/nn/layer/container.py
Outdated
>>> x = paddle.uniform(shape=[5, 2], dtype='float32') | ||
>>> num_stacked_param = 4 | ||
>>> model = MyLayer(num_stacked_param) | ||
>>> print(len(model.params)) # 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些 print 要作为输出,后面还有一些也是要改的
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么不用原来的 del
呢?是有什么问题么
There was a problem hiding this comment.
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 吧 ~
吃药 休息吧 ~ 哈哈哈哈 🤣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this 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') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…n/paddle/nn/layer/container.py (PaddlePaddle#56229) * [xdoctest][task 113] test=docs_preview * test=document_fix * test=document_fix
PR types
Others
PR changes
Docs
Description
对应tracking issue: #55629
预览链接: