'Creates the dictionary of predictions that is returned by the model.'

def _create_predictions(self, decoder_output, features, labels, losses=None):

    predictions = {}
    predictions.update(_flatten_dict({u'features': features}))
    if (labels is not None):
        predictions.update(_flatten_dict({u'labels': labels}))
    if (losses is not None):
        predictions[u'losses'] = _transpose_batch_time(losses)
    output_dict = collections.OrderedDict(zip(decoder_output._fields, decoder_output))
    decoder_output_flat = _flatten_dict(output_dict)
    decoder_output_flat = {k: _transpose_batch_time(v) for (k, v) in decoder_output_flat.items()}
    predictions.update(decoder_output_flat)
    if (u'predicted_ids' in predictions.keys()):
        vocab_tables = graph_utils.get_dict_from_collection(u'vocab_tables')
        target_id_to_vocab = vocab_tables[u'target_id_to_vocab']
        predicted_tokens = target_id_to_vocab.lookup(tf.to_int64(predictions[u'predicted_ids']))
        predictions[u'predicted_tokens'] = predicted_tokens
    return predictions
