code: def batch_to_embeddings(self, batch: List[List[str]]) -> Tuple[torch.Tensor, torch.Tensor]:
          
          character_ids = batch_to_ids(batch)
          if self.cuda_device >= 0:
              character_ids = character_ids.cuda(device=self.cuda_device)
  
          bilm_output = self.elmo_bilm(character_ids)
          layer_activations = bilm_output['activations']
          mask_with_bos_eos = bilm_output['mask']
  
          # without_bos_eos is a 3 element list of (activation, mask) tensor pairs,
          # each with size (batch_size, num_timesteps, dim and (batch_size, num_timesteps)
          # respectively.
          without_bos_eos = [remove_sentence_boundaries(layer, mask_with_bos_eos)
                             for layer in layer_activations]
          # Converts a list of pairs (activation, mask) tensors to a single tensor of activations.
          activations = torch.cat([ele[0].unsqueeze(1) for ele in without_bos_eos], dim=1)
          # The mask is the same for each ELMo vector, so just take the first.
          mask = without_bos_eos[0][1]
  
          return activations, mask
docs: Parameters
          ----------
          batch : ``List[List[str]]``, required
              A list of tokenized sentences.
  
          Returns
          -------
              A tuple of tensors, the first representing activations (batch_size, 3, num_timesteps, 1024) and
          the second a mask (batch_size, num_timesteps).