code: def test_shape_generator(
      num_classes=1,
      num_objects=3,
      batch_size=1,
      height=5,
      width=5,
      rotation=0.0,
      smoothing=False,
  ):
      t_g = torch.zeros((batch_size, height, width), dtype=torch.int64)
      t_p = None
      hv_g = torch.zeros((batch_size, 2, height, width))
      hv_p = torch.zeros((batch_size, 2, height, width))
  
      rad_min = 2
      rad_max = min(max(height // 3, width // 3, rad_min), 5)
  
      for b in range(batch_size):
          random.seed(10 + b)
          inst_map = torch.zeros((height, width), dtype=torch.int64)
          for inst_id in range(1, num_objects + 1):
              x = random.randint(rad_max, width - rad_max)
              y = random.randint(rad_max, height - rad_max)
              rad = random.randint(rad_min, rad_max)
              spy, spx = np.ogrid[-x : height - x, -y : width - y]
              circle = torch.tensor(
                  (spx * spx + spy * spy) <= rad * rad
              )
  
              if num_classes > 1:
                  t_g[b, circle] = np.ceil(
                      random.random() * num_classes
                  )
              else:
                  t_g[b, circle] = 1
  
              inst_map[circle] = inst_id
  
          hv_g[b] = ComputeHoVerMaps()(inst_map[None])
          hv_g[b] = hv_g[b].squeeze(0)
          if rotation > 0.0:
              hv_p[b] = Rotate(
                  angle=rotation, keep_size=True, mode="bilinear"
              )(hv_g[b])
  
      n_g = t_g > 0
      if rotation == 0.0:
          hv_p = hv_g * 0.99
  
      # rotation of prediction needs to happen before one-hot encoding
      if rotation > 0.0:
          n_p = Rotate(angle=rotation, keep_size=True, mode="nearest")(
              n_g
          )
          n_p = (
              F.one_hot(n_p.to(torch.int64))
              .to(torch.float32)
              .permute(0, 3, 1, 2)
          )
          if num_classes > 1:
              t_p = Rotate(
                  angle=rotation, keep_size=True, mode="nearest"
              )(t_g)
              t_p = (
                  F.one_hot(t_p.to(torch.int64))
                  .to(torch.float32)
                  .permute(0, 3, 1, 2)
              )
              t_g = (
                  F.one_hot(t_g.to(torch.int64))
                  .to(torch.float32)
                  .permute(0, 3, 1, 2)
              )
          else:
              t_g = None
      else:
          n_p = (
              F.one_hot(n_g.to(torch.int64))
              .to(torch.float32)
              .permute(0, 3, 1, 2)
          )
          if num_classes > 1:
              t_p = (
                  F.one_hot(t_g.to(torch.int64))
                  .to(torch.float32)
                  .permute(0, 3, 1, 2)
              )
              t_g = (
                  F.one_hot(t_g.to(torch.int64))
                  .to(torch.float32)
                  .permute(0, 3, 1, 2)
              )
          else:
              t_g = None
  
      n_g = (
          F.one_hot(n_g.to(torch.int64))
          .to(torch.float32)
          .permute(0, 3, 1, 2)
      )
  
      if smoothing:
          n_p = GaussianSmooth()(n_p)
          if num_classes > 1:
              t_p = GaussianSmooth()(t_p)
          hv_p = hv_p * 0.1
      else:
          n_p = torch.clamp(n_p, s, t)
          if num_classes > 1:
              t_p = torch.clamp(t_p, s, t)
  
      # Apply log to emulate logits
      if t_p is not None:
          return n_g, n_p.log(), hv_g, hv_p, t_g, t_p.log()
      else:
          return n_g, n_p.log(), hv_g, hv_p
  
file_path: MONAI/tests/test_hovernet_loss.py
imports: from __future__ import annotations
  import random
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from torch.nn import functional
  from monai.apps.pathology.losses import HoVerNetLoss
  from monai.transforms import GaussianSmooth, Rotate
  from monai.transforms.intensity.array import ComputeHoVerMaps
  from monai.utils.enums import HoVerNetBranch
label_desc: Use image node_id 1 for calling a global function with example usage: test_shape_generator(num_classes, num_objects, batch_size, height, width, rotation, smoothing) and returns: n_g,  n_p,  hv_g,  hv_p,  t_g,  t_p, n_g,  n_p,  hv_g,  hv_p