nnsvs.util.make_non_pad_mask

nnsvs.util.make_non_pad_mask(lengths, xs=None, length_dim=-1, maxlen=None)[source]

Make mask tensor containing indices of non-padded part.

Parameters:
  • lengths (LongTensor or List) – Batch of lengths (B,).

  • xs (Tensor, optional) – The reference tensor. If set, masks will be the same shape as this tensor.

  • length_dim (int, optional) – Dimension indicator of the above tensor.

Returns:

mask tensor containing indices of padded part.

dtype=torch.uint8 in PyTorch 1.2- dtype=torch.bool in PyTorch 1.2+ (including 1.2)

Return type:

ByteTensor