# Buggy code
def __init__(
    self, root, split="train", transform=None, target_transform=None, download=False
):
    if split not in self.splits:
        raise ValueError(
            'Split "{}" not found. Valid splits are: {}'.format(
                split,
                ", ".join(self.splits),
            )
        )
    self.root = os.path.expanduser(root)
    self.transform = transform
    self.target_transform = target_transform
    self.split = split  # train/test/unlabeled set

    if download:
        self.download()

    if not self._check_integrity():
        raise RuntimeError(
            "Dataset not found or corrupted. You can use download=True to download it"
        )

    # now load the picked numpy arrays
    if self.split == "train":
        self.data, self.labels = self.__loadfile(
            self.train_list[0][0], self.train_list[1][0]
        )
    elif self.split == "train+unlabeled":
        self.data, self.labels = self.__loadfile(
            self.train_list[0][0], self.train_list[1][0]
        )
        unlabeled_data, _ = self.__loadfile(self.train_list[2][0])
        self.data = np.concatenate((self.data, unlabeled_data))
        self.labels = np.concatenate(
            (self.labels, np.asarray([-1] * unlabeled_data.shape[0]))
        )

    elif self.split == "unlabeled":
        self.data, _ = self.__loadfile(self.train_list[2][0])
        self.labels = np.asarray([-1] * self.data.shape[0])
    else:  # self.split == 'test':
        self.data, self.labels = self.__loadfile(
            self.test_list[0][0], self.test_list[1][0]
        )

    class_file = os.path.join(self.root, self.base_folder, self.class_names_file)
    if os.path.isfile(class_file):
        with open(class_file) as f:
            self.classes = f.read().splitlines()


# Traceback (AttributeError)
In [1]: from torchvision.datasets import STL10

In [2]: data = STL10("Documents/dataset", download=True)
Files already downloaded and verified

In [3]: print(data)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-dbd883db58b7> in <module>
----> 1 print(data)

~/pythonenvs/bentley/lib/python3.7/site-packages/torchvision/datasets/vision.py in __repr__(self)
38             body.append("Root location: {}".format(self.root))
39         body += self.extra_repr().splitlines()
---> 40         if self.transforms is not None:
41             body += [repr(self.transforms)]
42         lines = [head] + [" " * self._repr_indent + line for line in body]

AttributeError: 'STL10' object has no attribute 'transforms'

# Fixed code
def __init__(
    self, root, split="train", transform=None, target_transform=None, download=False
):
    if split not in self.splits:
        raise ValueError(
            'Split "{}" not found. Valid splits are: {}'.format(
                split,
                ", ".join(self.splits),
            )
        )
    super(STL10, self).__init__(root)
    self.transform = transform
    self.target_transform = target_transform
    self.split = split  # train/test/unlabeled set

    if download:
        self.download()

    if not self._check_integrity():
        raise RuntimeError(
            "Dataset not found or corrupted. You can use download=True to download it"
        )

    # now load the picked numpy arrays
    if self.split == "train":
        self.data, self.labels = self.__loadfile(
            self.train_list[0][0], self.train_list[1][0]
        )
    elif self.split == "train+unlabeled":
        self.data, self.labels = self.__loadfile(
            self.train_list[0][0], self.train_list[1][0]
        )
        unlabeled_data, _ = self.__loadfile(self.train_list[2][0])
        self.data = np.concatenate((self.data, unlabeled_data))
        self.labels = np.concatenate(
            (self.labels, np.asarray([-1] * unlabeled_data.shape[0]))
        )

    elif self.split == "unlabeled":
        self.data, _ = self.__loadfile(self.train_list[2][0])
        self.labels = np.asarray([-1] * self.data.shape[0])
    else:  # self.split == 'test':
        self.data, self.labels = self.__loadfile(
            self.test_list[0][0], self.test_list[1][0]
        )

    class_file = os.path.join(self.root, self.base_folder, self.class_names_file)
    if os.path.isfile(class_file):
        with open(class_file) as f:
            self.classes = f.read().splitlines()