未验证 提交 a00cddd2 编写于 作者: C Chen Weihang 提交者: GitHub

Fix several cn doc sample code diff (#1967)

* fix build strategy cn doc sample code diff

* fix code error

* fix execution strategy error

* fix LayerNorm error
上级 d8cd6c54
...@@ -47,7 +47,7 @@ LayerNorm ...@@ -47,7 +47,7 @@ LayerNorm
x = numpy.random.random((3, 32, 32)).astype('float32') x = numpy.random.random((3, 32, 32)).astype('float32')
with fluid.dygraph.guard(): with fluid.dygraph.guard():
x = to_variable(x) x = to_variable(x)
layernorm = fluid.LayerNorm('LayerNorm', begin_norm_axis=1) layerNorm = fluid.LayerNorm([32, 32])
ret = layernorm(x) ret = layerNorm(x)
...@@ -7,7 +7,7 @@ BuildStrategy ...@@ -7,7 +7,7 @@ BuildStrategy
.. py:class:: paddle.fluid.BuildStrategy .. py:class:: paddle.fluid.BuildStrategy
``BuildStrategy`` 使用户更方便地控制[ ``ParallelExecutor`` ](../fluid_cn.html\#parallelexecutor)中计算图的建造方法,可通过设置 ``ParallelExecutor`` 中的 ``BuildStrategy`` 成员来实现此功能。 ``BuildStrategy`` 使用户更方便地控制 :ref:`cn_api_fluid_ParallelExecutor` 中计算图的建造方法,可通过设置 ``ParallelExecutor`` 中的 ``BuildStrategy`` 成员来实现此功能。
**代码示例** **代码示例**
...@@ -68,6 +68,7 @@ bool类型。表明是否融合(fuse) broadcast ops。该选项指在Reduce模 ...@@ -68,6 +68,7 @@ bool类型。表明是否融合(fuse) broadcast ops。该选项指在Reduce模
**代码示例** **代码示例**
.. code-block:: python .. code-block:: python
import paddle.fluid as fluid import paddle.fluid as fluid
build_strategy = fluid.BuildStrategy() build_strategy = fluid.BuildStrategy()
build_strategy.fuse_broadcast_ops = True build_strategy.fuse_broadcast_ops = True
...@@ -108,6 +109,7 @@ bool类型。表明是否融合(fuse) relu和depthwise_conv2d,节省GPU内存 ...@@ -108,6 +109,7 @@ bool类型。表明是否融合(fuse) relu和depthwise_conv2d,节省GPU内存
import os import os
import numpy as np import numpy as np
import paddle.fluid as fluid
import paddle.fluid.compiler as compiler import paddle.fluid.compiler as compiler
use_cuda = True use_cuda = True
......
...@@ -33,7 +33,7 @@ ExecutionStrategy ...@@ -33,7 +33,7 @@ ExecutionStrategy
train_exe = fluid.ParallelExecutor(use_cuda=False, train_exe = fluid.ParallelExecutor(use_cuda=False,
loss_name=avg_loss.name, loss_name=avg_loss.name,
exec_strategy=exec_strategy) exec_strategy=exec_strategy)
.. py:attribute:: num_iteration_per_drop_scope .. py:attribute:: num_iteration_per_drop_scope
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册