sequence#

sequence_mask(seq_ids, valid_lengths)[source]#

To boost the performance, this sequence_mask is different with paddle.nn.functional.sequence_mask

Parameters:
  • 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:

Returns the output sequence mask mask. Its dtype is bool and has a shape of [batch_size, sequence_length].

Return type:

Tensor