Subset wraps the passed Dataset in the self.dataset attribute.
You could add a condition to your code, which checks, if the mnist_dataset is wrapped in a Subset and then use self.mnist_dataset.dataset.train_labels.