未验证 提交 0642d9a8 编写于 作者: M minghaoBD 提交者: GitHub

[cherry pick]fix bug in api docs (#745) (#747)

上级 123fcc57
...@@ -45,6 +45,7 @@ UnstructuredPruner ...@@ -45,6 +45,7 @@ UnstructuredPruner
.. code-block:: python .. code-block:: python
import paddle
from paddleslim import UnstructuredPruner from paddleslim import UnstructuredPruner
from paddle.vision.models import LeNet as net from paddle.vision.models import LeNet as net
import numpy as np import numpy as np
...@@ -67,6 +68,7 @@ UnstructuredPruner ...@@ -67,6 +68,7 @@ UnstructuredPruner
.. code-block:: python .. code-block:: python
import paddle
from paddleslim import UnstructuredPruner from paddleslim import UnstructuredPruner
from paddle.vision.models import LeNet as net from paddle.vision.models import LeNet as net
import numpy as np import numpy as np
...@@ -101,6 +103,7 @@ UnstructuredPruner ...@@ -101,6 +103,7 @@ UnstructuredPruner
.. code-block:: python .. code-block:: python
import paddle
from paddleslim import UnstructuredPruner from paddleslim import UnstructuredPruner
from paddle.vision.models import LeNet as net from paddle.vision.models import LeNet as net
import numpy as np import numpy as np
...@@ -129,6 +132,7 @@ UnstructuredPruner ...@@ -129,6 +132,7 @@ UnstructuredPruner
.. code-block:: python .. code-block:: python
import paddle
from paddleslim import UnstructuredPruner from paddleslim import UnstructuredPruner
from paddle.vision.models import LeNet as net from paddle.vision.models import LeNet as net
import numpy as np import numpy as np
......
...@@ -26,7 +26,7 @@ UnstrucuturedPruner ...@@ -26,7 +26,7 @@ UnstrucuturedPruner
.. code-block:: python .. code-block:: python
import paddle as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import UnstructuredPruner from paddleslim.prune import UnstructuredPruner
...@@ -58,7 +58,7 @@ UnstrucuturedPruner ...@@ -58,7 +58,7 @@ UnstrucuturedPruner
.. code-block:: python .. code-block:: python
import paddle as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import UnstructuredPruner from paddleslim.prune import UnstructuredPruner
...@@ -93,7 +93,7 @@ UnstrucuturedPruner ...@@ -93,7 +93,7 @@ UnstrucuturedPruner
.. code-block:: python .. code-block:: python
import paddle as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import UnstructuredPruner from paddleslim.prune import UnstructuredPruner
...@@ -140,7 +140,7 @@ UnstrucuturedPruner ...@@ -140,7 +140,7 @@ UnstrucuturedPruner
.. code-block:: python .. code-block:: python
import paddle as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import UnstructuredPruner from paddleslim.prune import UnstructuredPruner
...@@ -183,7 +183,7 @@ UnstrucuturedPruner ...@@ -183,7 +183,7 @@ UnstrucuturedPruner
.. code-block:: python .. code-block:: python
import paddle as paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
from paddleslim.prune import UnstructuredPruner from paddleslim.prune import UnstructuredPruner
...@@ -204,6 +204,7 @@ UnstrucuturedPruner ...@@ -204,6 +204,7 @@ UnstrucuturedPruner
exe = paddle.static.Executor(place) exe = paddle.static.Executor(place)
exe.run(startup_program) exe.run(startup_program)
pruner = UnstructuredPruner(paddle.static.default_main_program(), 'ratio', ratio=0.5, place=place)
threshold = pruner.summarize_weights(paddle.static.default_main_program(), ratio=0.5) threshold = pruner.summarize_weights(paddle.static.default_main_program(), ratio=0.5)
print(threshold) print(threshold)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册