code: def batch_to_ids(batch: List[List[str]]) -> torch.Tensor:
      
      instances = []
      indexer = ELMoTokenCharactersIndexer()
      for sentence in batch:
          tokens = [Token(token) for token in sentence]
          field = TextField(tokens,
                            {'character_ids': indexer})
          instance = Instance({"elmo": field})
          instances.append(instance)
  
      dataset = Batch(instances)
      vocab = Vocabulary()
      dataset.index_instances(vocab)
      return dataset.as_tensor_dict()['elmo']['character_ids']
docs: Converts a batch of tokenized sentences to a tensor representing the sentences with encoded characters
      (len(batch), max sentence length, max word length).
  
      Parameters
      ----------
      batch : ``List[List[str]]``, required
          A list of tokenized sentences.
  
      Returns
      -------
          A tensor of padded character ids.