docstr: Computes the ELMo embeddings for a batch of tokenized sentences.
  
  Please note that ELMo has internal state and will give different results for the same input.
  See the comment under the class definition.
  
  Parameters
  ----------
  batch : ``List[List[str]]``, required
      A list of tokenized sentences.
  
  Returns
  -------
      A list of tensors, each representing the ELMo vectors for the input sentence at the same index.
docstr_tok: ["Computes","the","ELMo","embeddings","for","a","batch","of","tokenized","sentences",".","Please","note","that","ELMo","has","internal","state","and","will","give","different","results","for","the","same","input",".","See","the","comment","under","the","class","definition",".","Parameters","--","--","--","--","--","batch",":","``","List","[","List","[","str","]","]","``",",","required","A","list","of","tokenized","sentences",".","Returns","--","--","--","-","A","list","of","tensors",",","each","representing","the","ELMo","vectors","for","the","input","sentence","at","the","same","index","."]
code: def embed_batch(self, batch):
      """
      Computes the ELMo embeddings for a batch of tokenized sentences.
  
      Please note that ELMo has internal state and will give different results for the same input.
      See the comment under the class definition.
  
      Parameters
      ----------
      batch : ``List[List[str]]``, required
          A list of tokenized sentences.
  
      Returns
      -------
          A list of tensors, each representing the ELMo vectors for the input sentence at the same index.
      """
      elmo_embeddings = []
  
      # Batches with only an empty sentence will throw an exception inside AllenNLP, so we handle this case
      # and return an empty embedding instead.
      if batch == [[]]:
          elmo_embeddings.append(empty_embedding())
      else:
          embeddings, mask = self.batch_to_embeddings(batch)
          for i in range(len(batch)):
              length = int(mask[i, :].sum())
              # Slicing the embedding :0 throws an exception so we need to special case for empty sentences.
              if length == 0:
                  elmo_embeddings.append(empty_embedding())
              else:
                  elmo_embeddings.append(
                      embeddings[i, :, :length, :]
                      .detach()
                      .cpu()
                      .numpy()
                  )
  
      return elmo_embeddings
  
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 4 for calling the ElmoEmbedder obj's underlying member method code with example usage: obj.embed_batch(batch) and returns: elmo_embeddings