import tensorflow as tf

    scales_to_logits = outputs_to_scales_to_logits[output]
    logits = _resize_bilinear(
        scales_to_logits[MERGED_LOGITS_SCOPE],
        tf.shape(images)[1:3],
        scales_to_logits[MERGED_LOGITS_SCOPE].dtype)
    outputs_to_predictions[output].append(
        tf.expand_dims(tf.nn.softmax(logits), 4))

    if add_flipped_images:
      scales_to_logits_reversed = (
          outputs_to_scales_to_logits_reversed[output])
      logits_reversed = _resize_bilinear(
