import tensorflow as tf

                    clone_loss = _gather_clone_loss(clone, len(clones),
                                                    regularization_losses)
                    if clone_loss is not None:
                        clones_losses.append(clone_loss)
                    # Only use regularization_losses for the first clone
                    regularization_losses = None
            if clones_losses:
                total_loss = tf.add_n(clones_losses, name='total_loss')

        # Add the summaries from the first clone. These contain the summaries
        # created by model_fn and either optimize_clones() or _gather_clone_loss().
        summaries |= set(tf.get_collection(tf.GraphKeys.SUMMARIES,
                                           first_clone.scope))

        if total_loss is not None:
            # Add total_loss to summary.
            summaries.add(tf.summary.scalar('total_loss', total_loss))

        if summaries:
            # Merge all summaries together.
            summary_op = tf.merge_summary(list(summaries), name='summary_op')
        else:
