From 61c3edad65b675844852eff954b2b535dd9cfba3 Mon Sep 17 00:00:00 2001 From: shanyi15 Date: Sat, 9 Mar 2019 09:48:19 +0800 Subject: [PATCH 1/3] update_book_commitid --- external/book | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/external/book b/external/book index 2a1d135ccd1..2a6a637dc9e 160000 --- a/external/book +++ b/external/book @@ -1 +1 @@ -Subproject commit 2a1d135ccd10247954ba4cc5f870580a76b4530f +Subproject commit 2a6a637dc9e70d8683536fa2ef4a6d1d74fca8e0 From d330a105a0fbe92d1a8f6fd24e315e42f477f745 Mon Sep 17 00:00:00 2001 From: shanyi15 Date: Sat, 9 Mar 2019 09:54:57 +0800 Subject: [PATCH 2/3] commitid0309 --- doc/fluid/advanced_usage/development/new_op/new_op.md | 2 +- doc/fluid/advanced_usage/development/new_op/new_op_en.md | 8 ++++---- .../user_guides/howto/configure_simple_model/index.rst | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/fluid/advanced_usage/development/new_op/new_op.md b/doc/fluid/advanced_usage/development/new_op/new_op.md index ae42ee5162a..f5423cd6033 100644 --- a/doc/fluid/advanced_usage/development/new_op/new_op.md +++ b/doc/fluid/advanced_usage/development/new_op/new_op.md @@ -230,7 +230,7 @@ Op的输入和输出可分别通过`ExecutionContext::Input()`和`ExecutionCo `MulOp`的CPU、CUDA实现共享同一个`Kernel`。`OpKernel`不共享的例子可以参考:[`OnehotCrossEntropyOpKernel`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/cross_entropy_op.h#L43)。 -为了使`OpKernel`的计算过程书写更加简单,并且CPU、CUDA的代码可以复用,我们通常借助 Eigen unsupported Tensor模块来实现`Compute`接口。关于在PaddlePaddle中如何使用Eigen库,请参考[使用文档](https://github.com/PaddlePaddle/FluidDoc/blob/develop/doc/fluid/dev/use_eigen_cn.md)。 +为了使`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)。 到此,前向Op实现完成。接下来,需要在`.cc`文件中注册该op和kernel。 反向Op类的定义,反向OpKernel的定义与前向Op类似,这里不再赘述。**但需注意反向Op没有`ProtoMaker`**。 diff --git a/doc/fluid/advanced_usage/development/new_op/new_op_en.md b/doc/fluid/advanced_usage/development/new_op/new_op_en.md index 6b1a51b0abe..47d0c3c16d8 100644 --- a/doc/fluid/advanced_usage/development/new_op/new_op_en.md +++ b/doc/fluid/advanced_usage/development/new_op/new_op_en.md @@ -103,7 +103,7 @@ The equation is: Out = X * Y 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`. -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). +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). An additional example [`ScaleOp`](https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/fluid/operators/scale_op.cc#L38-L55) is implemented as follows: @@ -244,7 +244,7 @@ Note that **different devices (CPU, CUDA)share one Op definition; whether or not `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). -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). +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). 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 2.Using developer-defined variable abbreviations in error messages is not easy to understand. - Example of the problem: + Example of the problem: ``` PADDLE_ENFORCE(forward_pd != nullptr, "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 -#### Special Instructions for OP InferShape Check Message +#### Special Instructions for OP InferShape Check Message - Check input and output variables, please follow the following format `Input(variable name) of OP name operator should not be null.` diff --git a/doc/fluid/user_guides/howto/configure_simple_model/index.rst b/doc/fluid/user_guides/howto/configure_simple_model/index.rst index 5946a2ccb7e..dbac3a4db74 100644 --- a/doc/fluid/user_guides/howto/configure_simple_model/index.rst +++ b/doc/fluid/user_guides/howto/configure_simple_model/index.rst @@ -25,7 +25,7 @@ | 优化算法 | 随机梯度下降 | +----------------+----------------------------------------------+ -使用PaddlePadle建模 +使用PaddlePaddle建模 ################### 从逻辑层面明确了输入数据格式、模型结构、损失函数以及优化算法后,需要使用PaddlePaddle提供的API及算子来实现模型逻辑。一个典型的模型主要包含4个部分,分别是:输入数据格式定义,模型前向计算逻辑,损失函数以及优化算法。 From b7722aff918cdc91bc8a63d652d9766bbe4173ff Mon Sep 17 00:00:00 2001 From: shanyi15 Date: Sat, 9 Mar 2019 09:57:55 +0800 Subject: [PATCH 3/3] fix typo --- doc/fluid/advanced_usage/development/new_op/new_op.md | 2 +- doc/fluid/advanced_usage/development/new_op/new_op_en.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/fluid/advanced_usage/development/new_op/new_op.md b/doc/fluid/advanced_usage/development/new_op/new_op.md index f5423cd6033..5d36ed14a90 100644 --- a/doc/fluid/advanced_usage/development/new_op/new_op.md +++ b/doc/fluid/advanced_usage/development/new_op/new_op.md @@ -120,7 +120,7 @@ $$Out = scale*X$$ 这个例子有`AddAttr("scale", "...").SetDefault(1.0);` : 增加`scale`系数,作为参数属性,并且设置默认值为1.0。 ### 定义GradProtoMaker类 -每个Op的必须有一个对应的GraProtoMaker,若未定制对应前向Op的GradProtoMaker,fluid提供了DefaultGradProtoMaker,默认注册会使用全部输入输出,包括Input, Output, Output@Grad等,使用不需要的变量的会造成显存浪费。 +每个Op的必须有一个对应的GradProtoMaker,若未定制对应前向Op的GradProtoMaker,fluid提供了DefaultGradProtoMaker,默认注册会使用全部输入输出,包括Input, Output, Output@Grad等,使用不需要的变量的会造成显存浪费。 下面示例定义了ScaleOp的GradProtoMaker。 ```cpp diff --git a/doc/fluid/advanced_usage/development/new_op/new_op_en.md b/doc/fluid/advanced_usage/development/new_op/new_op_en.md index 47d0c3c16d8..89e150df45e 100644 --- a/doc/fluid/advanced_usage/development/new_op/new_op_en.md +++ b/doc/fluid/advanced_usage/development/new_op/new_op_en.md @@ -134,7 +134,7 @@ Note `AddAttr("scale", "...").SetDefault(1.0);` adds `scale`constant a ### Defining the GradProtoMaker class -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. +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. The following example defines ScaleOp's GradProtoMaker. ```cpp