Skip to content

Commit 6cd92b0

Browse files
authored
Update0309 (#684)
* add dataset api_cn (#673) * rm fluid.core in desigin_idea (#674) * Update fluid_design_idea.md * Update fluid_design_idea_en.md * Fix array_read code example error. (#671) Signed-off-by: zhaoyuchen <[email protected]> * add data_reader_cn (#676) * fix doc error (#675) * update_book_commitid (#680) * update_book_commitid * commitid0309 * fix typo * book indexes (#677)
1 parent 0b07bd8 commit 6cd92b0

File tree

22 files changed

+1045
-26
lines changed

22 files changed

+1045
-26
lines changed

doc/fluid/advanced_usage/design_idea/fluid_design_idea.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Fluid中使用fluid.Executor(place)创建Executor,place属性由用户定义
194194
下例代码表示创建一个Executor,其运行场所在CPU内:
195195
196196
```python
197-
cpu=core.CPUPlace()
197+
cpu=fluid.CPUPlace()
198198
exe = fluid.Executor(cpu)
199199
```
200200

@@ -329,7 +329,7 @@ Fluid使用Executor来执行网络训练,Executor运行细节请参考[Executo
329329
创建Executor只需调用 fluid.Executor(place) 即可,在此之前请您依据训练场所定义place变量:
330330
```python
331331
#在CPU内执行训练
332-
cpu = fluid.core.CPUPlace()
332+
cpu = fluid.CPUPlace()
333333
#创建Executor
334334
exe = fluid.Executor(cpu)
335335
```

doc/fluid/advanced_usage/design_idea/fluid_design_idea_en.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Fluid uses Fluid.Executor(place) to create an Executor. The place attribute is d
195195
The following code example creates an Executor that runs on CPU:
196196
197197
```python
198-
cpu=core.CPUPlace()
198+
cpu=fluid.CPUPlace()
199199
exe = fluid.Executor(cpu)
200200
```
201201

@@ -330,7 +330,7 @@ Fluid uses Executor to perform network training. For details on Executor operati
330330
To create an Executor, simply call fluid.Executor(place). Before that, please define a place variable based on the training site:
331331
```python
332332
#Execute training on CPU
333-
cpu = fluid.core.CPUPlace()
333+
cpu = fluid.CPUPlace()
334334
#Create Executor
335335
exe = fluid.Executor(cpu)
336336
```

doc/fluid/advanced_usage/development/new_op/new_op.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ $$Out = scale*X$$
120120
这个例子有`AddAttr<AttrType>("scale", "...").SetDefault(1.0);` : 增加`scale`系数,作为参数属性,并且设置默认值为1.0。
121121
122122
### 定义GradProtoMaker类
123-
每个Op的必须有一个对应的GraProtoMaker,若未定制对应前向Op的GradProtoMaker,fluid提供了DefaultGradProtoMaker,默认注册会使用全部输入输出,包括Input, Output, Output@Grad等,使用不需要的变量的会造成显存浪费。
123+
每个Op的必须有一个对应的GradProtoMaker,若未定制对应前向Op的GradProtoMaker,fluid提供了DefaultGradProtoMaker,默认注册会使用全部输入输出,包括Input, Output, Output@Grad等,使用不需要的变量的会造成显存浪费。
124124
下面示例定义了ScaleOp的GradProtoMaker。
125125
126126
```cpp
@@ -230,7 +230,7 @@ Op的输入和输出可分别通过`ExecutionContext::Input<T>()`和`ExecutionCo
230230

231231
`MulOp`的CPU、CUDA实现共享同一个`Kernel``OpKernel`不共享的例子可以参考:[`OnehotCrossEntropyOpKernel`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/cross_entropy_op.h#L43)
232232

233-
为了使`OpKernel`的计算过程书写更加简单,并且CPU、CUDA的代码可以复用,我们通常借助 Eigen unsupported Tensor模块来实现`Compute`接口。关于在PaddlePaddle中如何使用Eigen库,请参考[使用文档](https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/dev/use_eigen_cn.md)
233+
为了使`OpKernel`的计算过程书写更加简单,并且CPU、CUDA的代码可以复用,我们通常借助 Eigen unsupported Tensor模块来实现`Compute`接口。关于在PaddlePaddle中如何使用Eigen库,请参考[使用文档](https://github.com/PaddlePaddle/FluidDoc/blob/release/1.2/doc/fluid/dev/use_eigen_cn.md)
234234

235235
到此,前向Op实现完成。接下来,需要在`.cc`文件中注册该op和kernel。
236236
反向Op类的定义,反向OpKernel的定义与前向Op类似,这里不再赘述。**但需注意反向Op没有`ProtoMaker`**

doc/fluid/advanced_usage/development/new_op/new_op_en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ The equation is: Out = X * Y
103103
104104
The constructor utilizes `AddInput` to add input parameter, `AddOutput` to add output parameter, and `AddComment` to add comments for the Op, so that the corresponding information will be added to `OpProto`.
105105
106-
The code above adds two inputs `X` and `Y` to `MulOp`, an output `Out`, and their corresponding descriptions. Names are given in accordance to Paddle's [naming convention](https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/dev/name_convention.md).
106+
The code above adds two inputs `X` and `Y` to `MulOp`, an output `Out`, and their corresponding descriptions. Names are given in accordance to Paddle's [naming convention](https://github.com/PaddlePaddle/FluidDoc/blob/release/1.2/doc/fluid/dev/name_convention.md).
107107
108108
109109
An additional example [`ScaleOp`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/scale_op.cc#L38-L55) is implemented as follows:
@@ -134,7 +134,7 @@ Note `AddAttr<AttrType>("scale", "...").SetDefault(1.0);` adds `scale`constant a
134134
<a name="Defining the GradProtoMaker class"></a>
135135
### Defining the GradProtoMaker class
136136

137-
Each Op must have a corresponding GraProtoMaker. If GradProtoMaker corresponding to the forward Op is not customized, Fluid provides DefaultGradProtoMaker. The default registration will use all input and output, including Input, Output, Output@Grad and so on. Using unnecessary variables will cause waste of memory.
137+
Each Op must have a corresponding GradProtoMaker. If GradProtoMaker corresponding to the forward Op is not customized, Fluid provides DefaultGradProtoMaker. The default registration will use all input and output, including Input, Output, Output@Grad and so on. Using unnecessary variables will cause waste of memory.
138138
The following example defines ScaleOp's GradProtoMaker.
139139

140140
```cpp
@@ -244,7 +244,7 @@ Note that **different devices (CPU, CUDA)share one Op definition; whether or not
244244

245245
`MulOp`'s CPU and CUDA share the same `Kernel`. A non-sharing `OpKernel` example can be seen in [`OnehotCrossEntropyOpKernel`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/cross_entropy_op.cc).
246246

247-
To ease the writing of `OpKernel` compute, and for reusing code cross-device, [`Eigen-unsupported Tensor`](https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default) module is used to implement `Compute` interface. To learn about how the Eigen library is used in PaddlePaddle, please see [usage document](https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/dev/use_eigen_en.md).
247+
To ease the writing of `OpKernel` compute, and for reusing code cross-device, [`Eigen-unsupported Tensor`](https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default) module is used to implement `Compute` interface. To learn about how the Eigen library is used in PaddlePaddle, please see [usage document](https://github.com/PaddlePaddle/FluidDoc/blob/release/1.2/doc/fluid/dev/use_eigen_cn.md).
248248

249249

250250
This concludes the forward implementation of an operator. Next its operation and kernel need to be registered in a `.cc` file.
@@ -460,7 +460,7 @@ If it is not necessary or concise description is enough to clearly express the a
460460

461461
2.Using developer-defined variable abbreviations in error messages is not easy to understand.
462462

463-
Example of the problem:
463+
Example of the problem:
464464
```
465465
PADDLE_ENFORCE(forward_pd != nullptr,
466466
"Fail to find eltwise_fwd_pd in device context"); //eltwise_fwd_pduser may not be understood
@@ -481,7 +481,7 @@ If it is not necessary or concise description is enough to clearly express the a
481481
482482
483483
<a name="Special instructions for OP InferShape check message"></a>
484-
#### Special Instructions for OP InferShape Check Message
484+
#### Special Instructions for OP InferShape Check Message
485485
486486
- Check input and output variables, please follow the following format
487487
`Input(variable name) of OP name operator should not be null.`

0 commit comments

Comments
 (0)