def _has_y(self, dataset):
        """Remove y from the tf.data.Dataset if exists."""
        shapes = data_utils.dataset_shape(dataset)
        # Only one or less element in the first level.
        if len(shapes) <= 1:
            return False
        # The first level has more than 1 element.
        # The tree has 2 levels.
        for shape in shapes:
            if isinstance(shape, tuple):
                return True
        # The tree has one level.
        # It matches the single IO case.
        return (
            len(shapes) == 2
            and len(self.inputs) == 1
            and len(self.outputs) == 1
        )
Remove y from the tf.data.Dataset if exists.
autokeras/auto_model.py