diff --git a/doc/fluid/advanced_usage/development/new_op/op_notes.md b/doc/fluid/advanced_usage/development/new_op/op_notes.md index e3b4ea69fd1b1d4b2fed939208d418af08e15bf7..d864a6f98c69508c4f266e60000cb6a668fc1e75 100644 --- a/doc/fluid/advanced_usage/development/new_op/op_notes.md +++ b/doc/fluid/advanced_usage/development/new_op/op_notes.md @@ -148,7 +148,7 @@ GetExpectedKernelType方法是OperatorWithKernel类中用于获取指定设备 如果未使用带有初始化检查的方法,直接使用了`Tensor->type()`,可能会导致报出`holder_ should not be null. Tensor not initialized yet when Tensor::type()`的错误,例如[Paddle issue #19522](https://github.com/PaddlePaddle/Paddle/issues/19522) ,用户仅凭该错误信息将无法得知具体出错的Op,不利于调试。 ### 5.Op兼容性问题 -对Op的修改需要考虑兼容性问题,要保证Op修改之后,之前的模型都能够正常加载及运行。**所以现在不允许对已有的Op新增输入或者输出,不允许减去Op的已有属性及修改默认值** 。 +对Op的修改需要考虑兼容性问题,要保证Op修改之后,之前的模型都能够正常加载及运行,即新版本的Paddle预测库能成功加载运行旧版本训练的模型。**所以,需要保证Op的Input、Output和Attribute不能被修改(文档除外)或删除,可以新增Input、Output和Attribute,但是新增的Input,Output必须设置AsDispensable,新增的Attribute必须设置默认值。更多详细内容请参考[OP修改规范:Input/Output/Attribute只能做兼容修改](https://github.com/PaddlePaddle/Paddle/wiki/OP-Input-Output-Attribute-Compatibility-Modification)** 。 ### 6.ShareDataWith的调用 ShareDataWith的功能是使两个Tensor共享底层buffer,在调用这个操作的时候需要特别注意,在Op内部不能将ShareDataWith作用在Op的输出上,即Op输出的Tensor必须是Malloc出来的。 diff --git a/doc/fluid/advanced_usage/development/new_op/op_notes_en.md b/doc/fluid/advanced_usage/development/new_op/op_notes_en.md index 27d19e33e97424c0eb5203fc5e6fb9e9732650ec..0dd02dd35c6e3633d55f1e258c70f832923601d2 100644 --- a/doc/fluid/advanced_usage/development/new_op/op_notes_en.md +++ b/doc/fluid/advanced_usage/development/new_op/op_notes_en.md @@ -110,7 +110,7 @@ Never make any modification of the input data inside Op, as there may be other O Currently all OpKernel are required to register double and float data types. ### 4.Op compatibility issue -The modification of Op needs to consider the compatibility problem. Please ensure that the previous model can be loaded and run normally after the modification of Op. **So it is not allowed to add input or output to the existing Ops. It is not allowed to remove the existing properties of Op and modify the default value**. +The modification of Op needs to consider the compatibility problem. Please ensure that the previous model can be loaded and run normally after the modification of Op which means that the model trained by the old version can be loaded and run with Paddle inference library of new version. **So developers should ensure that the Input, Output and Attribute of OPs cannot be modified (except for documents) or deleted. And developers can add Input, Output and Attribute, but the added Input and Output must be set to be dispensable, and the default value of added Attribute must be set. For more details, please refer to [OP Input/Output/Attribute Compatibility Modification](https://github.com/PaddlePaddle/Paddle/wiki/OP-Input-Output-Attribute-Compatibility-Modification(English-Version))**. ### 5.Call ShareDataWith The function of ShareDataWith is to make the two Tensors share the underlying buffer. When calling this operation, special attention should be paid. In the Op, the ShareDataWith cannot be applied to the output of Op. In other words, the Tensor of the Op output must be from Malloc.