import tensorflow as tf

                var_shape = var.get_shape().as_list()
                if var_shape == saved_shapes[name]:
                    restored.append(var)
                else:
                    shape_conflicts.add(name)
        found_names -= shape_conflicts
        return (restored, sorted(found_names),
                sorted(missing_names), sorted(shape_conflicts))

    def load(self, checkpoint_path, flexible_restore=True):
        if tf.gfile.IsDirectory(checkpoint_path):
            checkpoint_path = tf.train.latest_checkpoint(checkpoint_path)
            if checkpoint_path is None:
                raise ValueError('Checkpoint directory is empty.')
        if flexible_restore:
            var_list, found, missing, conflicts = self._checkpoint_var_search(
                    checkpoint_path)
            tf.logging.info('Restoring variables: \n\t{}'.format(
                '\n\t'.join(found)))
            if len(missing) > 0:
