code: def _boxes_to_polygons(
      xmin: torch.Tensor,
      ymin: torch.Tensor,
      width: torch.Tensor,
      height: torch.Tensor,
  ) -> torch.Tensor:
      if not xmin.ndim == ymin.ndim == width.ndim == height.ndim == 2:
          raise ValueError(
              "We expect to create a batch of 2D boxes (quadrilaterals) in vertices format (B, N, 4, 2)"
          )
  
      # Create (B,N,4,2) with all points in top left position of boxes
      polygons = zeros(
          (xmin.shape[0], xmin.shape[1], 4, 2),
          device=xmin.device,
          dtype=xmin.dtype,
      )
      polygons[..., 0] = xmin.unsqueeze(-1)
      polygons[..., 1] = ymin.unsqueeze(-1)
      # Shift top-right, bottom-right, bottom-left points to the right coordinates
      polygons[..., 1, 0] += width - 1  # Top right
      polygons[..., 2, 0] += width - 1  # Bottom right
      polygons[..., 2, 1] += height - 1  # Bottom right
      polygons[..., 3, 1] += height - 1  # Bottom left
      return polygons
  
imports: from __future__ import annotations
  from typing import Optional, cast
  import torch
  from torch import Size
  from kornia.core import Tensor, stack, zeros
  from kornia.geometry.bbox import validate_bbox
  from kornia.geometry.linalg import transform_points
  from kornia.utils import eye_like
label_desc: Use image node_id 4 for calling a global function with example usage: _boxes_to_polygons(xmin, ymin, width, height) and returns: polygons