(self, decode_results)
Merge in the output dimension.
Merge in the output dimension.
Merge in the output dimension .
def _merge_decode_results(self, decode_results):
    """Merge in the output dimension."""
    output_axis = -1
    assert decode_results
    zipped_results = lstm_utils.LstmDecodeResults(*list(zip(*decode_results)))
    with tf.control_dependencies([
        tf.assert_equal(
            zipped_results.final_sequence_lengths, self.hparams.max_seq_len,
            message='Variable length not supported by '
                    'MultiOutCategoricalLstmDecoder.')]):
      if zipped_results.final_state[0] is None:
        final_state = None
      else:
        final_state = tf.nest.map_structure(
            lambda x: tf.concat(x, axis=output_axis),
            zipped_results.final_state)

      return lstm_utils.LstmDecodeResults(
          rnn_output=tf.concat(zipped_results.rnn_output, axis=output_axis),
          rnn_input=tf.concat(zipped_results.rnn_input, axis=output_axis),
          samples=tf.concat(zipped_results.samples, axis=output_axis),
          final_state=final_state,
          final_sequence_lengths=zipped_results.final_sequence_lengths[0])
def _merge_decode_results ( self , decode_results ) : output_axis = - 1 assert decode_results zipped_results = lstm_utils . LstmDecodeResults ( * list ( zip ( * decode_results ) ) ) with tf . control_dependencies ( [ tf . assert_equal ( zipped_results . final_sequence_lengths , self . hparams . max_seq_len , message = 'Variable length not supported by ' 'MultiOutCategoricalLstmDecoder.' ) ] ) : if zipped_results . final_state [ 0 ] is None : final_state = None else : final_state = tf . nest . map_structure ( lambda x : tf . concat ( x , axis = output_axis ) , zipped_results . final_state ) return lstm_utils . LstmDecodeResults ( rnn_output = tf . concat ( zipped_results . rnn_output , axis = output_axis ) , rnn_input = tf . concat ( zipped_results . rnn_input , axis = output_axis ) , samples = tf . concat ( zipped_results . samples , axis = output_axis ) , final_state = final_state , final_sequence_lengths = zipped_results . final_sequence_lengths [ 0 ] )