def decode(initial_state, cell, helper, beam_width=1, projection_layer=None):
    if (beam_width > 1):
        beam_initial_state = tf.contrib.seq2seq.tile_batch(initial_state, beam_width)
        decoder = tf.contrib.seq2seq.BeamSearchDecoder(cell=cell, embedding=targets_embeddings, start_tokens=start_tokens, end_token=END_SYMBOL, initial_state=beam_initial_state, beam_width=beam_width, output_layer=projection_layer)
    else:
        decoder = BasicDecoder(cell=cell, helper=helper, initial_state=initial_state, output_layer=projection_layer)
    outputs = tf.contrib.seq2seq.dynamic_decode(decoder=decoder, output_time_major=False, impute_finished=(False if (beam_width > 1) else True), maximum_iterations=max_sequence_length)
    return outputs
def decode(initial_state, cell, helper, beam_width=1, projection_layer=None):
    if (beam_width > 1):
        beam_initial_state = tf.contrib.seq2seq.tile_batch(initial_state, beam_width)
        decoder = tf.contrib.seq2seq.BeamSearchDecoder(cell=cell, embedding=targets_embeddings, start_tokens=start_tokens, end_token=END_SYMBOL, initial_state=beam_initial_state, beam_width=beam_width, output_layer=projection_layer)
    else:
        decoder = BasicDecoder(cell=cell, helper=helper, initial_state=initial_state, output_layer=projection_layer)
    outputs = tf.contrib.seq2seq.dynamic_decode(decoder=decoder, output_time_major=False, impute_finished=(False if (beam_width > 1) else True), maximum_iterations=max_sequence_length)
    return outputs