code: def test_mixup_transform(
      alpha: float,
      p: float,
      sample_key: str,
      target_key: str,
      batch_size: int,
  ) -> None:
      # this function tests the Mixup transforms
      parser = argparse.ArgumentParser()
      parser = torch_transforms.RandomMixup.add_arguments(parser)
  
      opts = parser.parse_args([])
  
      num_classes = 10
  
      setattr(opts, "image_augmentation.mixup.alpha", alpha)
      setattr(opts, "image_augmentation.mixup.p", p)
      setattr(opts, "image_augmentation.mixup.sample_key", sample_key)
      setattr(opts, "image_augmentation.mixup.target_key", target_key)
  
      # torch.roll works with batch size of 0. So, we expect to see the same shape as
      # input when applying mixup transforms
      img_tensor = torch.randn(size=(batch_size, 3, 8, 8))
      label_tensor = torch.randint(
          low=0, high=num_classes, size=(batch_size,)
      )
  
      data = {
          "samples": img_tensor
          if sample_key is None
          else {sample_key: img_tensor},
          "targets": label_tensor
          if target_key is None
          else {target_key: label_tensor},
      }
  
      try:
          transform = torch_transforms.RandomMixup(
              opts, num_classes=num_classes
          )
          out = transform(data)
          assert {"samples", "targets"}.issubset(list(out.keys()))
          if sample_key is None:
              assert out["samples"].shape == img_tensor.shape
          else:
              assert (
                  out["samples"][sample_key].shape == img_tensor.shape
              )
          if target_key is None:
              assert out["targets"].shape == label_tensor.shape
          else:
              assert (
                  out["targets"][target_key].shape == label_tensor.shape
              )
      except AssertionError as e:
          if str(e) == "Alpha param can't be zero":
              pytest.skip(str(e))
          elif (
              str(e)
              == "Mixup probability should be between 0 and 1, where 1 is inclusive"
          ):
              pytest.skip(str(e))
  
file_path: ml-cvnets/tests/transforms/test_image.py
imports: import argparse
  import random
  from typing import Tuple, Union
  import pytest
  import torch
  from PIL import Image
  from data.transforms import image_pil
  from data.transforms import image_torch
label_desc: Use image node_id 2 for calling a global function with example usage: test_mixup_transform(alpha, p, sample_key, target_key, batch_size) without return types