|
|
|
@ -57,11 +57,21 @@ 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", "(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.
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|