def _generate_step_for_batch(self, event_sequences, inputs, initial_state, temperature):
    'Extends a batch of event sequences by a single step each.\n\n    This method modifies the event sequences in place.\n\n    Args:\n      event_sequences: A list of event sequences, each of which is a Python\n          list-like object. The list of event sequences should have length equal\n          to `self._batch_size()`. These are extended by this method.\n      inputs: A Python list of model inputs, with length equal to\n          `self._batch_size()`.\n      initial_state: A numpy array containing the initial RNN state, where\n          `initial_state.shape[0]` is equal to `self._batch_size()`.\n      temperature: The softmax temperature.\n\n    Returns:\n      final_state: The final RNN state, a numpy array the same size as\n          `initial_state`.\n      loglik: The log-likelihood of the chosen softmax value for each event\n          sequence, a 1-D numpy array of length\n          `self._batch_size()`. If `inputs` is a full-length inputs batch, the\n          log-likelihood of each entire sequence up to and including the\n          generated step will be computed and returned.\n    '
    assert (len(event_sequences) == self._batch_size())
    graph_inputs = self._session.graph.get_collection('inputs')[0]
    graph_initial_state = self._session.graph.get_collection('initial_state')
    graph_final_state = self._session.graph.get_collection('final_state')
    graph_softmax = self._session.graph.get_collection('softmax')[0]
    graph_temperature = self._session.graph.get_collection('temperature')
    feed_dict = {graph_inputs: inputs, tuple(graph_initial_state): initial_state}
    if graph_temperature:
        feed_dict[graph_temperature[0]] = temperature
    (final_state, softmax) = self._session.run([graph_final_state, graph_softmax], feed_dict)
    if isinstance(softmax, list):
        if (softmax[0].shape[1] > 1):
            softmaxes = []
            for beam in range(softmax[0].shape[0]):
                beam_softmaxes = []
                for event in range((softmax[0].shape[1] - 1)):
                    beam_softmaxes.append([softmax[s][(beam, event)] for s in range(len(softmax))])
                softmaxes.append(beam_softmaxes)
            loglik = self._config.encoder_decoder.evaluate_log_likelihood(event_sequences, softmaxes)
        else:
            loglik = np.zeros(len(event_sequences))
    elif (softmax.shape[1] > 1):
        loglik = self._config.encoder_decoder.evaluate_log_likelihood(event_sequences, softmax[:, :(- 1), :])
    else:
        loglik = np.zeros(len(event_sequences))
    indices = np.array(self._config.encoder_decoder.extend_event_sequences(event_sequences, softmax))
    if isinstance(softmax, list):
        p = 1.0
        for i in range(len(softmax)):
            p *= softmax[i][(range(len(event_sequences)), (- 1), indices[:, i])]
    else:
        p = softmax[(range(len(event_sequences)), (- 1), indices)]
    return (final_state, (loglik + np.log(p)))
Extends a batch of event sequences by a single step each.

This method modifies the event sequences in place.

Args:
  event_sequences: A list of event sequences, each of which is a Python
      list-like object. The list of event sequences should have length equal
      to `self._batch_size()`. These are extended by this method.
  inputs: A Python list of model inputs, with length equal to
      `self._batch_size()`.
  initial_state: A numpy array containing the initial RNN state, where
      `initial_state.shape[0]` is equal to `self._batch_size()`.
  temperature: The softmax temperature.

Returns:
  final_state: The final RNN state, a numpy array the same size as
      `initial_state`.
  loglik: The log-likelihood of the chosen softmax value for each event
      sequence, a 1-D numpy array of length
      `self._batch_size()`. If `inputs` is a full-length inputs batch, the
      log-likelihood of each entire sequence up to and including the
      generated step will be computed and returned.
def _generate_step_for_batch(self, event_sequences, inputs, initial_state, temperature):
    'Extends a batch of event sequences by a single step each.\n\n    This method modifies the event sequences in place.\n\n    Args:\n      event_sequences: A list of event sequences, each of which is a Python\n          list-like object. The list of event sequences should have length equal\n          to `self._batch_size()`. These are extended by this method.\n      inputs: A Python list of model inputs, with length equal to\n          `self._batch_size()`.\n      initial_state: A numpy array containing the initial RNN state, where\n          `initial_state.shape[0]` is equal to `self._batch_size()`.\n      temperature: The softmax temperature.\n\n    Returns:\n      final_state: The final RNN state, a numpy array the same size as\n          `initial_state`.\n      loglik: The log-likelihood of the chosen softmax value for each event\n          sequence, a 1-D numpy array of length\n          `self._batch_size()`. If `inputs` is a full-length inputs batch, the\n          log-likelihood of each entire sequence up to and including the\n          generated step will be computed and returned.\n    '
    assert (len(event_sequences) == self._batch_size())
    graph_inputs = self._session.graph.get_collection('inputs')[0]
    graph_initial_state = self._session.graph.get_collection('initial_state')
    graph_final_state = self._session.graph.get_collection('final_state')
    graph_softmax = self._session.graph.get_collection('softmax')[0]
    graph_temperature = self._session.graph.get_collection('temperature')
    feed_dict = {graph_inputs: inputs, tuple(graph_initial_state): initial_state}
    if graph_temperature:
        feed_dict[graph_temperature[0]] = temperature
    (final_state, softmax) = self._session.run([graph_final_state, graph_softmax], feed_dict)
    if isinstance(softmax, list):
        if (softmax[0].shape[1] > 1):
            softmaxes = []
            for beam in range(softmax[0].shape[0]):
                beam_softmaxes = []
                for event in range((softmax[0].shape[1] - 1)):
                    beam_softmaxes.append([softmax[s][(beam, event)] for s in range(len(softmax))])
                softmaxes.append(beam_softmaxes)
            loglik = self._config.encoder_decoder.evaluate_log_likelihood(event_sequences, softmaxes)
        else:
            loglik = np.zeros(len(event_sequences))
    elif (softmax.shape[1] > 1):
        loglik = self._config.encoder_decoder.evaluate_log_likelihood(event_sequences, softmax[:, :(- 1), :])
    else:
        loglik = np.zeros(len(event_sequences))
    indices = np.array(self._config.encoder_decoder.extend_event_sequences(event_sequences, softmax))
    if isinstance(softmax, list):
        p = 1.0
        for i in range(len(softmax)):
            p *= softmax[i][(range(len(event_sequences)), (- 1), indices[:, i])]
    else:
        p = softmax[(range(len(event_sequences)), (- 1), indices)]
    return (final_state, (loglik + np.log(p)))