code: def bbox_generator3d(
      x_start: torch.Tensor,
      y_start: torch.Tensor,
      z_start: torch.Tensor,
      width: torch.Tensor,
      height: torch.Tensor,
      depth: torch.Tensor,
  ) -> torch.Tensor:
      """Generate 3D bounding boxes according to the provided start coords, width, height and depth.
  
      Args:
          x_start: a tensor containing the x coordinates of the bounding boxes to be extracted. Shape must be a scalar
              tensor or :math:`(B,)`.
          y_start: a tensor containing the y coordinates of the bounding boxes to be extracted. Shape must be a scalar
              tensor or :math:`(B,)`.
          z_start: a tensor containing the z coordinates of the bounding boxes to be extracted. Shape must be a scalar
              tensor or :math:`(B,)`.
          width: widths of the masked image. Shape must be a scalar tensor or :math:`(B,)`.
          height: heights of the masked image. Shape must be a scalar tensor or :math:`(B,)`.
          depth: depths of the masked image. Shape must be a scalar tensor or :math:`(B,)`.
  
      Returns:
          the 3d bounding box tensor :math:`(B, 8, 3)`.
  
      Examples:
          >>> x_start = torch.tensor([0, 3])
          >>> y_start = torch.tensor([1, 4])
          >>> z_start = torch.tensor([2, 5])
          >>> width = torch.tensor([10, 40])
          >>> height = torch.tensor([20, 50])
          >>> depth = torch.tensor([30, 60])
          >>> bbox_generator3d(x_start, y_start, z_start, width, height, depth)
          tensor([[[ 0,  1,  2],
                   [10,  1,  2],
                   [10, 21,  2],
                   [ 0, 21,  2],
                   [ 0,  1, 32],
                   [10,  1, 32],
                   [10, 21, 32],
                   [ 0, 21, 32]],
          <BLANKLINE>
                  [[ 3,  4,  5],
                   [43,  4,  5],
                   [43, 54,  5],
                   [ 3, 54,  5],
                   [ 3,  4, 65],
                   [43,  4, 65],
                   [43, 54, 65],
                   [ 3, 54, 65]]])
      """
      if not (
          x_start.shape == y_start.shape == z_start.shape
          and x_start.dim() in [0, 1]
      ):
          raise AssertionError(
              f"`x_start`, `y_start` and `z_start` must be a scalar or (B,). Got {x_start}, {y_start}, {z_start}."
          )
      if not (
          width.shape == height.shape == depth.shape
          and width.dim() in [0, 1]
      ):
          raise AssertionError(
              f"`width`, `height` and `depth` must be a scalar or (B,). Got {width}, {height}, {depth}."
          )
      if (
          not x_start.dtype
          == y_start.dtype
          == z_start.dtype
          == width.dtype
          == height.dtype
          == depth.dtype
      ):
          raise AssertionError(
              "All tensors must be in the same dtype. "
              f"Got `x_start`({x_start.dtype}), `y_start`({x_start.dtype}), `z_start`({x_start.dtype}), "
              f"`width`({width.dtype}), `height`({height.dtype}) and `depth`({depth.dtype})."
          )
      if (
          not x_start.device
          == y_start.device
          == z_start.device
          == width.device
          == height.device
          == depth.device
      ):
          raise AssertionError(
              "All tensors must be in the same device. "
              f"Got `x_start`({x_start.device}), `y_start`({x_start.device}), `z_start`({x_start.device}), "
              f"`width`({width.device}), `height`({height.device}) and `depth`({depth.device})."
          )
  
      # front
      bbox = torch.tensor(
          [[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]],
          device=x_start.device,
          dtype=x_start.dtype,
      ).repeat(len(x_start), 1, 1)
  
      bbox[:, :, 0] += x_start.view(-1, 1)
      bbox[:, :, 1] += y_start.view(-1, 1)
      bbox[:, :, 2] += z_start.view(-1, 1)
      bbox[:, 1, 0] += width
      bbox[:, 2, 0] += width
      bbox[:, 2, 1] += height
      bbox[:, 3, 1] += height
  
      # back
      bbox_back = bbox.clone()
      bbox_back[:, :, -1] += depth.unsqueeze(dim=1).repeat(1, 4)
      bbox = torch.cat([bbox, bbox_back], dim=1)
  
      return bbox
  
file_path: kornia/kornia/geometry/bbox.py
imports: from __future__ import annotations
  import warnings
  from typing import Optional
  import torch
  from kornia.core import arange, ones_like, stack, where, zeros
  from .linalg import transform_points
label_desc: Use image node_id 8 for calling a global function with example usage: bbox_generator3d(x_start, y_start, z_start, width, height, depth) and returns: bbox