espnet.nets.pytorch_backend.transformer.add_sos_eos.add_sos_eos
Less than 1 minute
espnet.nets.pytorch_backend.transformer.add_sos_eos.add_sos_eos
espnet.nets.pytorch_backend.transformer.add_sos_eos.add_sos_eos(ys_pad, sos, eos, ignore_id, repeat=1)
Add <sos> and <eos> labels.
- Parameters:
- ys_pad (torch.Tensor) – batch of padded target sequences (B, Lmax)
- sos (int) – index of <sos>
- eos (int) – index of <eos>
- ignore_id (int) – index of padding
- Returns: padded tensor (B, Lmax)
- Return type: torch.Tensor
- Returns: padded tensor (B, Lmax)
- Return type: torch.Tensor