code: def get_sklearn_digits_dataset(loader):
      """Downloads Sklearn handwritten digits dataset.
      Uses the last SKLEARN_DIGITS_TEST_SIZE examples as the test
      This is (hard-coded) -- do not change.
  
      Parameters
      ----------
      loader : str (values: 'train' or 'test')."""
      from torch.utils.data import Dataset
      from sklearn.datasets import load_digits
  
      class TorchDataset(Dataset):
          """Abstracts a numpy array as a PyTorch dataset."""
  
          def __init__(self, data, targets, transform=None):
              self.data = torch.from_numpy(data).float()
              self.targets = torch.from_numpy(targets).long()
              self.transform = transform
  
          def __getitem__(self, index):
              x = self.data[index]
              y = self.targets[index]
              if self.transform:
                  x = self.transform(x)
              return x, y
  
          def __len__(self):
              return len(self.data)
  
      transform = transforms.Compose(
          [
              transforms.ToPILImage(),
              transforms.Resize(28),
              transforms.ToTensor(),
              transforms.Normalize((0.1307,), (0.3081,)),
          ]
      )
      # Get sklearn digits dataset
      X_all, y_all = load_digits(return_X_y=True)
      X_all = X_all.reshape((len(X_all), 8, 8))
      y_train = y_all[:-SKLEARN_DIGITS_TEST_SIZE]
      y_test = y_all[-SKLEARN_DIGITS_TEST_SIZE:]
      X_train = X_all[:-SKLEARN_DIGITS_TEST_SIZE]
      X_test = X_all[-SKLEARN_DIGITS_TEST_SIZE:]
      if loader == "train":
          return TorchDataset(X_train, y_train, transform=transform)
      elif loader == "test":
          return TorchDataset(X_test, y_test, transform=transform)
      else:  # prama: no cover
          raise ValueError(
              "loader must be either str 'train' or str 'test'."
          )
  
imports: from sklearn.base import BaseEstimator
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  from torchvision import datasets, transforms
  from torch.autograd import Variable
  from torch.utils.data.sampler import SubsetRandomSampler
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: get_sklearn_digits_dataset(loader) and returns: TorchDataset, x,  y, len, TorchDataset