import tensorflow as tf

                                                         global_step=global_step)
                update_ops.append(grad_updates)

                update_op = tf.group(*update_ops)
                train_op = control_flow_ops.with_dependencies([update_op], total_loss,
                                                              name='train_op')
        else:
            clones_losses = []
            regularization_losses = tf.get_collection(
                    tf.GraphKeys.REGULARIZATION_LOSSES)
            for clone in clones:
                with tf.name_scope(clone.scope):
                    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
