espnet.nets.pytorch_backend.maskctc.add_mask_token.mask_uniform
Less than 1 minute
espnet.nets.pytorch_backend.maskctc.add_mask_token.mask_uniform
espnet.nets.pytorch_backend.maskctc.add_mask_token.mask_uniform(ys_pad, mask_token, eos, ignore_id)
Replace random tokens with <mask> label and add <eos> label.
The number of <mask> is chosen from a uniform distribution between one and the target sequence’s length. :param torch.Tensor ys_pad: batch of padded target sequences (B, Lmax) :param int mask_token: index of <mask> :param int eos: index of <eos> :param int ignore_id: index of padding :return: padded tensor (B, Lmax) :rtype: torch.Tensor :return: padded tensor (B, Lmax) :rtype: torch.Tensor