code: def test_integration():
      transform_pipeline = Compose([Resize((64, 64)), ToTensor()])
      cifar10_train = DummyDataset(transform_pipeline)
      cifar10_test = DummyDataset(transform_pipeline)
  
      al_dataset = ActiveLearningDataset(
          cifar10_train,
          pool_specifics={"transform": transform_pipeline},
      )
      al_dataset.label_randomly(10)
  
      use_cuda = False
      model = vgg.vgg11(pretrained=False, num_classes=10)
  
      criterion = nn.CrossEntropyLoss()
      optimizer = optim.SGD(
          model.parameters(),
          lr=0.001,
          momentum=0.9,
          weight_decay=0.0005,
      )
  
      # We can now use BaaL to create the active learning loop.
  
      model = ModelWrapper(model, criterion)
      # We create an ActiveLearningLoop that will automatically label the most uncertain samples.
      # In this case, we use the widely used BALD heuristic.
  
      active_loop = ActiveLearningLoop(
          al_dataset,
          model.predict_on_dataset,
          heuristic=heuristics.BALD(),
          query_size=10,
          batch_size=10,
          iterations=2,
          use_cuda=use_cuda,
          workers=4,
      )
  
      # We're all set!
      num_steps = 10
      for step in range(num_steps):
          old_param = list(
              map(lambda x: x.clone(), model.model.parameters())
          )
          model.train_on_dataset(
              al_dataset,
              optimizer=optimizer,
              batch_size=10,
              epoch=1,
              use_cuda=use_cuda,
              workers=2,
          )
          model.test_on_dataset(
              cifar10_test, batch_size=10, use_cuda=use_cuda, workers=2
          )
  
          if not active_loop.step():
              break
          new_param = list(
              map(lambda x: x.clone(), model.model.parameters())
          )
          assert any(
              [
                  not np.allclose(i.detach(), j.detach())
                  for i, j in zip(old_param, new_param)
              ]
          )
      assert step == 4
  
imports: import os
  import numpy
  import pytest
  from PIL import Image
  from torch import nn
  from torch import optim
  from torch.utils.data import Dataset
  from torchvision.models import vgg
  from torchvision.transforms import ToTensor, Resize, Compose
  from baal.active import ActiveLearningDataset
  from baal.active import ActiveLearningLoop
  from baal.active import heuristics
  from baal.modelwrapper import ModelWrapper
  from baal.calibration import DirichletCalibrator
label_desc: Use image node_id 1 for calling a global function with example usage: test_integration() without return types