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 165] reformat example code with google style in python/paddle/vision/ops.py #57108

Merged
merged 5 commits into from
Sep 11, 2023

Conversation

liyongchao911
Copy link
Contributor

PR types

Others

PR changes

Others

Description

修改如下文件的示例代码,使其通过 xdoctest 检查:

  • python/paddle/vision/ops.py

Related links

@sunzhongkai588 @SigureMo @megemini

@paddle-bot
Copy link

paddle-bot bot commented Sep 8, 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 the contributor External developers label Sep 8, 2023
@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Sep 8, 2023
@@ -1888,7 +1879,7 @@ def nms(
Args:
boxes(Tensor): The input boxes data to be computed, it's a 2D-Tensor with
the shape of [num_boxes, 4]. The data type is float32 or float64.
Given as [[x1, y1, x2, y2], ], (x1, y1) is the top left coordinates,
Given as [[x1, y1, x2, y2], ��], (x1, y1) is the top left coordinates,
Copy link
Contributor

Choose a reason for hiding this comment

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

乱码?

Comment on lines +2102 to +2110
>>> print(rois, roi_probs, roi_nums)
Tensor(shape=[2, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0., 0., 0., 0.],
[0., 0., 0., 0.]])
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.],
[0.]])
Tensor(shape=[2], dtype=int32, place=Place(cpu), stop_gradient=True,
[1, 1])
Copy link
Contributor

Choose a reason for hiding this comment

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

加个 seed 吧(好像也不管用 ... ...)~ 不然有一定概率会不是 0 ~

Comment on lines 175 to 188
>>> import paddle
>>> x = paddle.rand([2, 14, 8, 8]).astype('float32')
>>> gt_box = paddle.rand([2, 10, 4]).astype('float32')
>>> gt_label = paddle.rand([2, 10]).astype('int32')
>>> loss = paddle.vision.ops.yolo_loss(x,
... gt_box=gt_box,
... gt_label=gt_label,
... anchors=[10, 13, 16, 30],
... anchor_mask=[0, 1],
... class_num=2,
... ignore_thresh=0.7,
... downsample_ratio=8,
... use_label_smooth=True,
... scale_x_y=1.)
Copy link
Member

Choose a reason for hiding this comment

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

需要加缩进

@@ -356,19 +353,19 @@ def yolo_box(

.. code-block:: python
Copy link
Member

Choose a reason for hiding this comment

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

需要加缩进

Comment on lines 2100 to 2114
>>> print(rois, roi_probs, roi_nums)
Tensor(shape=[2, 4], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0., 0., 0., 0.],
[0., 0., 0., 0.]])

>>> # doctest: +SKIP('random sample')
>>> print(roi_probs, roi_nums)
Tensor(shape=[2, 1], dtype=float32, place=Place(cpu), stop_gradient=True,
[[0.],
[0.]])

>>> # doctest: -SKIP
>>> print(roi_nums)
Tensor(shape=[2], dtype=int32, place=Place(cpu), stop_gradient=True,
[1, 1])
Copy link
Contributor

Choose a reason for hiding this comment

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

这里整体跳过就行 ~

另外,每次 print 一个就行 ~ 这每次少 print 一个 ... ... 忒抽象了 ~ 🤣🤣🤣

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 76b8463 into PaddlePaddle:develop Sep 11, 2023
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