docstr: Class for MNISTIndAttribute dataset.
  
  :param root: The directory where data can be found (or should be downloaded to, if it does not exist).
  :param download: Binary flag indicating whether data should be downloaded
  :returns: an instance of MultipleDomainDataset class
docstr_tok: ["Class","for","MNISTIndAttribute","dataset",".",":","param","root",":","The","directory","where","data","can","be","found","(","or","should","be","downloaded","to",",","if","it","does","not","exist",")",".",":","param","download",":","Binary","flag","indicating","whether","data","should","be","downloaded",":","returns",":","an","instance","of","MultipleDomainDataset","class"]
code: def __init__(self, root, download=True):
      """Class for MNISTIndAttribute dataset.
  
      :param root: The directory where data can be found (or should be downloaded to, if it does not exist).
      :param download: Binary flag indicating whether data should be downloaded
      :returns: an instance of MultipleDomainDataset class
  
      """
  
      super().__init__()
      if root is None:
          raise ValueError("Data directory not specified!")
  
      original_dataset_tr = MNIST(root, train=True, download=download)
  
      original_images = original_dataset_tr.data
      original_labels = original_dataset_tr.targets
  
      shuffle = torch.randperm(len(original_images))
      original_images = original_images[shuffle]
      original_labels = original_labels[shuffle]
  
      self.datasets = []
  
      angles = ["15", "60", "90"]
      for i, env in enumerate(angles[:-1]):
          images = original_images[:50000][i::2]
          labels = original_labels[:50000][i::2]
          self.datasets.append(
              self.rotate_dataset(images, labels, i, angles[i])
          )
      images = original_images[50000:]
      labels = original_labels[50000:]
      self.datasets.append(
          self.rotate_dataset(
              images, labels, len(angles) - 1, angles[-1]
          )
      )
  
      # test environment
      original_dataset_te = MNIST(root, train=False, download=download)
      original_images = original_dataset_te.data
      original_labels = original_dataset_te.targets
      self.datasets.append(
          self.rotate_dataset(
              original_images,
              original_labels,
              len(angles) - 1,
              angles[-1],
          )
      )
  
      self.input_shape = self.INPUT_SHAPE
      self.num_classes = 2
  
imports: import torch
  import torchvision
  from PIL import Image
  from torch.utils.data import TensorDataset
  from torchvision import transforms
  from torchvision.datasets import MNIST
  from torchvision.transforms.functional import rotate
  from dowhy.causal_prediction.datasets.base_dataset import MultipleDomainDataset
label_desc: Use image node_id 1 to create a new MNISTIndAttribute object from inherited base classes: MultipleDomainDataset with example: obj = MNISTIndAttribute(root, download)