-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
python/paddle/vision/ops.py
Outdated
@@ -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, |
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(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]) |
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.
加个 seed 吧(好像也不管用 ... ...)~ 不然有一定概率会不是 0 ~
python/paddle/vision/ops.py
Outdated
>>> 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.) |
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/vision/ops.py
Outdated
@@ -356,19 +353,19 @@ def yolo_box( | |||
|
|||
.. code-block:: python |
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/vision/ops.py
Outdated
>>> 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]) |
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 一个就行 ~ 这每次少 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.
LGTMeow 🐾
PR types
Others
PR changes
Others
Description
修改如下文件的示例代码,使其通过
xdoctest
检查:Related links
@sunzhongkai588 @SigureMo @megemini