From 8cd5e37a92e354dc8de4d01c0aeacfe21be5c389 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Mon, 27 Nov 2017 15:11:17 +0800 Subject: [PATCH 1/2] Complete shrink_rnn_memory_op comments --- paddle/operators/shrink_rnn_memory_op.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/paddle/operators/shrink_rnn_memory_op.cc b/paddle/operators/shrink_rnn_memory_op.cc index 65bccc0c81d0ad..326e3f9bade04f 100644 --- a/paddle/operators/shrink_rnn_memory_op.cc +++ b/paddle/operators/shrink_rnn_memory_op.cc @@ -57,11 +57,22 @@ class ShrinkRNNMemoryOpProtoMaker : public framework::OpProtoAndCheckerMaker { ShrinkRNNMemoryOpProtoMaker(framework::OpProto *proto, framework::OpAttrChecker *op_checker) : OpProtoAndCheckerMaker(proto, op_checker) { - AddInput("X", ""); - AddInput("RankTable", ""); - AddInput("I", ""); - AddOutput("Out", ""); - AddComment(""); + AddInput("X", "The RNN step memory to be shrinked."); + AddInput("RankTable", "The lod_rank_table of dynamic RNN."); + AddInput( + "I", + "The step index. The RNN step memory 'X' will be shrinked to match " + "the size of the input of the index'th step."); + AddOutput("Out", "The shrinked RNN step memory."); + AddComment( + R"DOC( + In dynamic RNN, we are able to handle sequences of different lengths. + Because of the multiple lengths, the size of each step input can be + different, which may lead to a mismatching between the input of + the current step and the memory generated by the previous one. This + operator shrinks memory according to the size of the next step input, + to make sure that they can match each other. + )DOC"); } }; From 897b043e94cf5e9b2f005598ee88f7360f3a5056 Mon Sep 17 00:00:00 2001 From: fengjiayi Date: Mon, 27 Nov 2017 15:14:38 +0800 Subject: [PATCH 2/2] Update --- paddle/operators/shrink_rnn_memory_op.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/paddle/operators/shrink_rnn_memory_op.cc b/paddle/operators/shrink_rnn_memory_op.cc index 326e3f9bade04f..299722e0948a92 100644 --- a/paddle/operators/shrink_rnn_memory_op.cc +++ b/paddle/operators/shrink_rnn_memory_op.cc @@ -57,13 +57,12 @@ class ShrinkRNNMemoryOpProtoMaker : public framework::OpProtoAndCheckerMaker { ShrinkRNNMemoryOpProtoMaker(framework::OpProto *proto, framework::OpAttrChecker *op_checker) : OpProtoAndCheckerMaker(proto, op_checker) { - AddInput("X", "The RNN step memory to be shrinked."); - AddInput("RankTable", "The lod_rank_table of dynamic RNN."); - AddInput( - "I", - "The step index. The RNN step memory 'X' will be shrinked to match " - "the size of the input of the index'th step."); - AddOutput("Out", "The shrinked RNN step memory."); + AddInput("X", "(LoDTensor) The RNN step memory to be shrinked."); + AddInput("RankTable", "(LoDRankTable) The lod_rank_table of dynamic RNN."); + AddInput("I", + "(LoDTensor) The step index. The RNN step memory 'X' will be " + "shrinked to match the size of the input of the index'th step."); + AddOutput("Out", "(LoDTensor) The shrinked RNN step memory."); AddComment( R"DOC( In dynamic RNN, we are able to handle sequences of different lengths.