def METHOD_NAME(
        self,
        input: torch.Tensor,
):
    if self.char_inputs:
        chars = input.view(-1, self.max_char_len)
        pads = chars[:, 0].eq(CHAR_PAD_IDX)
        eos = chars[:, 0].eq(CHAR_EOS_IDX)
        if eos.any():
            if self.onnx_trace:
                chars = torch.where(eos.unsqueeze(1), chars.new_zeros(1), chars)
            else:
                chars[eos] = 0
        unk = None
    else:
        flat_words = input.view(-1)
        chars = self.word_to_char[flat_words.type_as(self.word_to_char)].type_as(input)
        pads = flat_words.eq(self.vocab.pad())
        eos = flat_words.eq(self.vocab.eos())
        unk = flat_words.eq(self.vocab.unk())
    word_embs = self._convolve(chars)
    if self.onnx_trace:
        if pads.any():
            word_embs = torch.where(pads.unsqueeze(1), word_embs.new_zeros(1), word_embs)
        if eos.any():
            word_embs = torch.where(eos.unsqueeze(1), self.symbol_embeddings[self.eos_idx], word_embs)
        if unk is not None and unk.any():
            word_embs = torch.where(unk.unsqueeze(1), self.symbol_embeddings[self.unk_idx], word_embs)
    else:
        if pads.any():
            word_embs[pads] = 0
        if eos.any():
            word_embs[eos] = self.symbol_embeddings[self.eos_idx]
        if unk is not None and unk.any():
            word_embs[unk] = self.symbol_embeddings[self.unk_idx]
    return word_embs.view(input.size()[:2] + (-1,))