docs: def process(self, element):
      """Run batch prediciton on a TF graph.
  
      Args:
        element: list of strings, representing one batch input to the TF graph.
      """
      import collections
      import apache_beam as beam
  
      num_in_batch = 0
      try:
        assert self._session is not None
  
        feed_dict = collections.defaultdict(list)
        for line in element:
  
          # Remove trailing newline.
          if line.endswith('\n'):
            line = line[:-1]
  
          feed_dict[self._input_alias_map.values()[0]].append(line)
          num_in_batch += 1
  
        # batch_result is list of numpy arrays with batch_size many rows.
        batch_result = self._session.run(fetches=self._tensor_names,
                                         feed_dict=feed_dict)
  
        # ex batch_result for batch_size > 1:
        # (array([value1, value2, ..., value_batch_size]),
        #  array([[a1, b1, c1]], ..., [a_batch_size, b_batch_size, c_batch_size]]),
        #  ...)
        # ex batch_result for batch_size == 1:
        # (value,
        #  array([a1, b1, c1]),
        #  ...)
  
        # Convert the results into a dict and unbatch the results.
        if num_in_batch > 1:
          for result in zip(*batch_result):
            predictions = {}
            for name, value in zip(self._aliases, result):
              predictions[name] = (value.tolist() if getattr(value, 'tolist', None) else value)
            yield predictions
        else:
          predictions = {}
          for i in range(len(self._aliases)):
            value = batch_result[i]
            value = (value.tolist() if getattr(value, 'tolist', None)
                     else value)
            predictions[self._aliases[i]] = value
          yield predictions
  
      except Exception as e:  # pylint: disable=broad-except
        yield beam.pvalue.TaggedOutput('errors', (str(e), element))