code: def _boxes3d_to_polygons3d(
      xmin: torch.Tensor,
      ymin: torch.Tensor,
      zmin: torch.Tensor,
      width: torch.Tensor,
      height: torch.Tensor,
      depth: torch.Tensor,
  ) -> torch.Tensor:
      if (
          not xmin.ndim
          == ymin.ndim
          == zmin.ndim
          == width.ndim
          == height.ndim
          == depth.ndim
          == 2
      ):
          raise ValueError(
              "We expect to create a batch of 3D boxes (hexahedrons) in vertices format (B, N, 8, 3)"
          )
  
      # Front
      # Create (B,N,4,3) with all points in front top left position of boxes
      front_vertices = zeros(
          (xmin.shape[0], xmin.shape[1], 4, 3),
          device=xmin.device,
          dtype=xmin.dtype,
      )
      front_vertices[..., 0] = xmin.unsqueeze(-1)
      front_vertices[..., 1] = ymin.unsqueeze(-1)
      front_vertices[..., 2] = zmin.unsqueeze(-1)
      # Shift front-top-right, front-bottom-right, front-bottom-left points to the right coordinates
      front_vertices[..., 1, 0] += width - 1  # Top right
      front_vertices[..., 2, 0] += width - 1  # Bottom right
      front_vertices[..., 2, 1] += height - 1  # Bottom right
      front_vertices[..., 3, 1] += height - 1  # Bottom left
  
      # Back
      back_vertices = front_vertices.clone()
      back_vertices[..., 2] += depth.unsqueeze(-1) - 1
  
      polygons3d = torch.cat([front_vertices, back_vertices], dim=-2)
      return polygons3d
  
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 6 for calling a global function with example usage: _boxes3d_to_polygons3d(xmin, ymin, zmin, width, height, depth) and returns: polygons3d