-
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 143] Reformat example code with google style in quantization/quantization_pass.py #56240
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
✅ This PR's description meets the template requirements! |
.. code-block:: python | ||
# The original graph will be rewrite. | ||
import paddle.static as static | ||
from paddle.static.quantization \ | ||
import QuantizationTransformPass | ||
from paddle.fluid.framework import IrGraph | ||
from paddle.framework import core | ||
|
||
graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
place = paddle.CPUPlace() | ||
transform_pass = QuantizationTransformPass(static.global_scope(), | ||
place) | ||
transform_pass.apply(graph) | ||
|
||
>>> # The original graph will be rewrite. | ||
>>> import paddle.static as static | ||
>>> from paddle.static.quantization import QuantizationTransformPass | ||
>>> from paddle.fluid.framework import IrGraph | ||
>>> from paddle.framework import core | ||
|
||
>>> graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
>>> place = paddle.CPUPlace() | ||
>>> transform_pass = QuantizationTransformPass(static.global_scope(), place) | ||
>>> transform_pass.apply(graph) |
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.
缩进 +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.
是指 空行+1 吧?我看了其他人的PR ,缩进都是与 code 单词对齐的呀
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.
这里是指 Examples 与 code-block 之间的缩进
def foo():
"""
Examples:
.. code-block:: python
import paddle
...
"""
当然空行也得加
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.
其他 PR 也是同样的问题,就不一一回复了
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.
以及最好不要用 test=document_fix,预览可能无法构建
.. code-block:: python | ||
# The original graph will be rewrite. | ||
import paddle | ||
from paddle.static.quantization \ | ||
import QuantizationTransformPassV2 | ||
from paddle.fluid.framework import IrGraph | ||
from paddle.framework import core | ||
|
||
graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
place = paddle.CPUPlace() | ||
scope = paddle.static.global_scope() | ||
transform_pass = QuantizationTransformPassV2(scope, place) | ||
transform_pass.apply(graph) | ||
|
||
>>> # The original graph will be rewrite. | ||
>>> import paddle | ||
>>> import paddle.static as static | ||
>>> from paddle.static.quantization import QuantizationTransformPassV2 | ||
>>> from paddle.fluid.framework import IrGraph | ||
>>> from paddle.framework import core | ||
|
||
>>> graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
>>> place = paddle.CPUPlace() | ||
>>> scope = paddle.static.global_scope() | ||
>>> transform_pass = QuantizationTransformPassV2(scope, place) | ||
>>> transform_pass.apply(graph) |
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.
缩进 +1
.. code-block:: python | ||
# The original graph will be rewrite. | ||
import paddle | ||
from paddle.static.quantization \ | ||
import AddQuantDequantPassV2 | ||
from paddle.fluid.framework import IrGraph | ||
from paddle.framework import core | ||
|
||
graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
place = paddle.CPUPlace() | ||
scope = paddle.static.global_scope() | ||
add_quant_dequant_pass = AddQuantDequantPassV2(scope, place) | ||
add_quant_dequant_pass.apply(graph) | ||
|
||
>>> # The original graph will be rewrite. | ||
>>> import paddle | ||
>>> import paddle.static as static | ||
>>> from paddle.static.quantization import AddQuantDequantPassV2 | ||
>>> from paddle.fluid.framework import IrGraph | ||
>>> from paddle.framework import core | ||
|
||
>>> graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
>>> place = paddle.CPUPlace() | ||
>>> scope = paddle.static.global_scope() | ||
>>> add_quant_dequant_pass = AddQuantDequantPassV2(scope, place) | ||
>>> add_quant_dequant_pass.apply(graph) |
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.
缩进 +1
.. code-block:: python | ||
# The original graph will be rewrite. | ||
import paddle | ||
from paddle.static.quantization \ | ||
import ReplaceFakeQuantDequantPass | ||
from paddle.fluid.framework import IrGraph | ||
from paddle.framework import core | ||
|
||
graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
place = paddle.CPUPlace() | ||
scope = paddle.static.global_scope() | ||
replace_pass = ReplaceFakeQuantDequantPass(scope, place) | ||
replace_pass.apply(graph) | ||
|
||
>>> # The original graph will be rewrite. | ||
>>> import paddle | ||
>>> import paddle.static as static | ||
>>> from paddle.static.quantization import ReplaceFakeQuantDequantPass | ||
>>> from paddle.fluid.framework import IrGraph | ||
>>> from paddle.framework import core | ||
|
||
>>> graph = IrGraph(core.Graph(static.Program().desc), for_test=False) | ||
>>> place = paddle.CPUPlace() | ||
>>> scope = paddle.static.global_scope() | ||
>>> replace_pass = ReplaceFakeQuantDequantPass(scope, place) | ||
>>> replace_pass.apply(graph) |
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.
缩进 +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.
LGTMeow 🐾
…ization/quantization_pass.py (PaddlePaddle#56240) * [xdoctest][task 143] test=docs_preview * test=document_fix * fix indent * fix indent in python/paddle/static/quantization/quantization_pass.py --------- Co-authored-by: SigureMo <[email protected]>
PR types
Others
PR changes
Docs
Description
对应tracking issue: #55629
预览链接: