code: def __init__(
      self,
      save_path=None,
      train_batch_size=256,
      test_batch_size=512,
      valid_size=None,
      n_worker=32,
      resize_scale=0.08,
      distort_color=None,
  ):
      self._save_path = save_path
      train_transforms = self.build_train_transform(
          distort_color, resize_scale
      )
      train_dataset = datasets.ImageFolder(
          self.train_path, train_transforms
      )
  
      if valid_size is not None:
          if isinstance(valid_size, float):
              valid_size = int(valid_size * len(train_dataset))
          else:
              assert isinstance(valid_size, int), (
                  "invalid valid_size: %s" % valid_size
              )
          train_indexes, valid_indexes = self.random_sample_valid_set(
              [cls for _, cls in train_dataset.samples],
              valid_size,
              self.n_classes,
          )
          train_sampler = torch.utils.data.sampler.SubsetRandomSampler(
              train_indexes
          )
          valid_sampler = torch.utils.data.sampler.SubsetRandomSampler(
              valid_indexes
          )
  
          valid_dataset = datasets.ImageFolder(
              self.train_path,
              transforms.Compose(
                  [
                      transforms.Resize(self.resize_value),
                      transforms.CenterCrop(self.image_size),
                      transforms.ToTensor(),
                      self.normalize,
                  ]
              ),
          )
  
          self.train = torch.utils.data.DataLoader(
              train_dataset,
              batch_size=train_batch_size,
              sampler=train_sampler,
              num_workers=n_worker,
              pin_memory=True,
          )
          self.valid = torch.utils.data.DataLoader(
              valid_dataset,
              batch_size=test_batch_size,
              sampler=valid_sampler,
              num_workers=n_worker,
              pin_memory=True,
          )
      else:
          self.train = torch.utils.data.DataLoader(
              train_dataset,
              batch_size=train_batch_size,
              shuffle=True,
              num_workers=n_worker,
              pin_memory=True,
          )
          self.valid = None
  
      self.test = torch.utils.data.DataLoader(
          datasets.ImageFolder(
              self.valid_path,
              transforms.Compose(
                  [
                      transforms.Resize(self.resize_value),
                      transforms.CenterCrop(self.image_size),
                      transforms.ToTensor(),
                      self.normalize,
                  ]
              ),
          ),
          batch_size=test_batch_size,
          shuffle=False,
          num_workers=n_worker,
          pin_memory=True,
      )
  
      if self.valid is None:
          self.valid = self.test
  
imports: import os
  import numpy
  import torch.utils.data
  import torchvision.transforms
  import torchvision.datasets
label_desc: Use image node_id 1 to create a new ImagenetDataProvider object from inherited base classes: DataProvider with example: obj = ImagenetDataProvider(save_path, train_batch_size, test_batch_size, valid_size, n_worker, resize_scale, distort_color)