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] reformat example code with google style in No. 240 #56474

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

Liyulingyue
Copy link
Contributor

PR types

Others

PR changes

Others

Description

#55629

@paddle-bot
Copy link

paddle-bot bot commented Aug 20, 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 20, 2023
@Liyulingyue
Copy link
Contributor Author

@SigureMo 发起Review申请🐕

Copy link
Contributor

@megemini megemini left a comment

Choose a reason for hiding this comment

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

check 2d 的结果有两处错误,请确认是不是程序的 bug ~

Comment on lines 60 to 67
>>> import numpy as np
>>> from paddle.incubate.asp import CheckMethod, MaskAlgo

CheckMethod.get_checking_method(MaskAlgo.MASK_1D)
# CheckMethod.CHECK_1D
>>> CheckMethod.get_checking_method(MaskAlgo.MASK_1D)

CheckMethod.get_checking_method(MaskAlgo.MASK_2D_GREEDY)
# CheckMethod.CHECK_2D
>>> CheckMethod.get_checking_method(MaskAlgo.MASK_2D_GREEDY)

CheckMethod.get_checking_method(MaskAlgo.MASK_2D_BEST)
# CheckMethod.CHECK_2D
>>> CheckMethod.get_checking_method(MaskAlgo.MASK_2D_BEST)
Copy link
Contributor

Choose a reason for hiding this comment

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

输出呢?

sparsity.check_mask_1d(mask, 2, 4) # True
>>> mat = np.array([[0, 1, 5, 4],
... [2, 7, 3, 6]])
>>> mask = sparsity.get_mask_1d(mat, 2, 4)
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 296 to 302
>>> x = np.array([[0, 8, 0, 9],
... [9, 0, 0, 10],
... [0, 5, 0, 6],
... [0, 4, 6, 0]])
>>> y = sparsity.check_mask_2d(x, 2, 4)
>>> print(y)
False
Copy link
Contributor

Choose a reason for hiding this comment

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

在最新的 paddle 上面运行,结果为 True。

请确认一下,是本来就应该是 True,还是这里有 bug?

... [9, 2, 1, 10],
... [5, 1, 3, 6],
... [2, 4, 6, 1]])
>>> mask = sparsity.get_mask_2d_greedy(mat, 2, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

输出

>>> print("L1 norm of `greedy` sparse matrix", np.multiply(mat, mask_greedy).sum())
L1 norm of `greedy` sparse matrix 56.0
>>> print("L1 norm of `best` sparse matrix", np.multiply(mat, mask_best).sum())
L1 norm of `greedy` sparse matrix 56.0
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 513 to 514
>>> mask_1d = sparsity.create_mask(tensor, func_name=sparsity.MaskAlgo.MASK_1D)
>>> mask_2d = sparsity.create_mask(tensor, func_name=sparsity.MaskAlgo.MASK_2D_BEST)
Copy link
Contributor

Choose a reason for hiding this comment

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

输出呢

... [9, 1, 3, 9],
... [5, 6, 3, 9],
... [2, 4, 6, 9]])
>>> mask_1d = sparsity.create_mask(tensor, func_name=sparsity.MaskAlgo.MASK_1D)
Copy link
Contributor

Choose a reason for hiding this comment

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

输出

True
>>> y = sparsity.check_sparsity(mask_1d, func_name=sparsity.CheckMethod.CHECK_2D)
>>> print(y)
False
Copy link
Contributor

Choose a reason for hiding this comment

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

这里结果不对,请确认是不是程序的 bug ~

@luotao1 luotao1 added the HappyOpenSource Pro 进阶版快乐开源活动,更具挑战性的任务 label Aug 21, 2023
@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Aug 28, 2023

Sorry to inform you that 6ff3da6's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

Copy link
Contributor

@megemini megemini left a comment

Choose a reason for hiding this comment

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

LGTM ~ 辛苦!

@luotao1 luotao1 merged commit fc1e1b7 into PaddlePaddle:develop Aug 29, 2023
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
@Liyulingyue Liyulingyue deleted the xdoc_240 branch September 23, 2023 16:09
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