提交 98a83cd2 编写于 作者: C caoying03

follow comments.

上级 89ea288c
......@@ -97,19 +97,13 @@ void KmaxSeqScoreLayer::forward(PassType passType) {
scores_ = inputScore;
}
Matrix::resizeOrCreate(
output_.value,
input.hasSubseq() ? input.getNumSubSequences() : input.getNumSequences(),
beamSize_,
false,
false);
int seqNum =
input.hasSubseq() ? input.getNumSubSequences() : input.getNumSequences();
Matrix::resizeOrCreate(output_.value, seqNum, beamSize_, false, false);
output_.value->one();
output_.value->mulScalar(-1.);
kmaxScorePerSeq(scores_->getData(),
output_.value->getData(),
input.hasSubseq() ? input.subSequenceStartPositions
: input.sequenceStartPositions);
kmaxScorePerSeq(scores_->getData(), output_.value->getData(), seqNum);
}
void KmaxSeqScoreLayer::backward(const UpdateCallback& callback) {}
......
......@@ -6129,7 +6129,7 @@ def clip_layer(input, min, max, name=None):
@layer_support()
def kmax_sequence_score_layer(input, name=None, beam_size=1):
"""
This layer accepts one input which is scores over a sequence or a nested
This layer accepts one input which are scores over a sequence or a nested
sequence, and returns indices of beam_size sequences with highest scores.
.. code-block:: python
......@@ -6139,7 +6139,7 @@ def kmax_sequence_score_layer(input, name=None, beam_size=1):
:param name: The Layer Name.
:type name: basestring
:param input: The input layer. It is scores over a sequence or a nested
:param input: The input layer. It stores scores over a sequence or a nested
sequence and its size must be 1.
:type input: LayerOutput.
:param beam_size: squence indices with top beam_size scores are returned.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册