sequence¶
-
sequence_mask
(seq_ids, valid_lengths)[源代码]¶ To boost the performance, this sequence_mask is different with paddle.nn.functional.sequence_mask
- 参数
seq_ids (Tensor) -- The whole sequence index, a tensor with a shape of [batch_size, sequence_length].
valid_lengths (Tensor) -- The valid length of every sequence, a tensor with a shape of [batch_size].
- 返回
Returns the output sequence mask
mask
. Its dtype isbool
and has a shape of [batch_size, sequence_length].- 返回类型
Tensor