code: def _test_searchspace_on_dataset(
      searchspace: ModelSpace, dataset="cifar10", arch=None, retry=1
  ):
      if arch is not None:
          model = searchspace.freeze(arch)
      else:
          for _ in range(retry):
              try:
                  model = searchspace.random()
                  break
              except ConstraintViolation as e:
                  pass
          else:
              raise e
  
      if dataset == "cifar10":
          train_data = FakeData(
              size=200,
              image_size=(3, 32, 32),
              num_classes=10,
              transform=transforms.ToTensor(),
          )
          valid_data = FakeData(
              size=200,
              image_size=(3, 32, 32),
              num_classes=10,
              transform=transforms.ToTensor(),
          )
  
      elif dataset == "imagenet":
          train_data = FakeData(
              size=200,
              image_size=(3, 224, 224),
              num_classes=1000,
              transform=transforms.ToTensor(),
          )
          valid_data = FakeData(
              size=200,
              image_size=(3, 224, 224),
              num_classes=1000,
              transform=transforms.ToTensor(),
          )
  
      train_dataloader = pl.DataLoader(
          train_data, batch_size=4, shuffle=True
      )
      valid_dataloader = pl.DataLoader(valid_data, batch_size=6)
  
      evaluator = pl.Classification(
          train_dataloader=train_dataloader,
          val_dataloaders=valid_dataloader,
          export_onnx=False,
          max_epochs=1,
          limit_train_batches=2,
          limit_val_batches=3,
          num_classes=10 if dataset == "cifar10" else 1000,
      )
      evaluator.evaluate(model)
  
file_path: nni/test/algo/nas/hub/test_sanity.py
imports: from torchvision import transforms
  from torchvision.datasets import FakeData
  import pytest
  import pytorch_lightning
  import nni
  import nni.nas.evaluator.pytorch.lightning
  import nni.nas.hub.pytorch
  from nni.mutable import ConstraintViolation
  from nni.nas.nn.pytorch import ModelSpace
label_desc: Use image node_id 1 for calling a global function with example usage: _test_searchspace_on_dataset(searchspace, dataset, arch, retry) without return types