docstr: 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).
docstr_tok: ["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",")","."]
code: def batch_to_embeddings(self, batch):
      """
      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).
      """
      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
  
imports: from __future__ import with_statement
  from __future__ import absolute_import
  import argparse
  import json
  import logging
  import os
  import warnings
  import numpy
  import torch
  from allennlp.common.tqdm import Tqdm
  from allennlp.common.util import lazy_groups_of, prepare_global_logging
  from allennlp.common.checks import ConfigurationError
  from allennlp.data.token_indexers.elmo_indexer import ELMoTokenCharactersIndexer
  from allennlp.nn.util import remove_sentence_boundaries
  from allennlp.modules.elmo import _ElmoBiLm, batch_to_ids
  from allennlp.commands.subcommand import Subcommand
label_desc: Use image node_id 2 for calling the ElmoEmbedder obj's underlying member method code with example usage: obj.batch_to_embeddings(batch) and returns: activations,  mask