code: def infer_bbox_shape(
      boxes: torch.Tensor,
  ) -> tuple[torch.Tensor, torch.Tensor]:
      r"""Auto-infer the output sizes for the given 2D bounding boxes.
  
      Args:
          boxes: a tensor containing the coordinates of the bounding boxes to be extracted. The tensor must have the shape
              of Bx4x2, where each box is defined in the following ``clockwise`` order: top-left, top-right, bottom-right,
              bottom-left. The coordinates must be in the x, y order.
  
      Returns:
          - Bounding box heights, shape of :math:`(B,)`.
          - Boundingbox widths, shape of :math:`(B,)`.
  
      Example:
          >>> boxes = torch.tensor([[
          ...     [1., 1.],
          ...     [2., 1.],
          ...     [2., 2.],
          ...     [1., 2.],
          ... ], [
          ...     [1., 1.],
          ...     [3., 1.],
          ...     [3., 2.],
          ...     [1., 2.],
          ... ]])  # 2x4x2
          >>> infer_bbox_shape(boxes)
          (tensor([2., 2.]), tensor([2., 3.]))
      """
      validate_bbox(boxes)
      width: torch.Tensor = boxes[:, 1, 0] - boxes[:, 0, 0] + 1
      height: torch.Tensor = boxes[:, 2, 1] - boxes[:, 0, 1] + 1
      return height, width
  
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 3 for calling a global function with example usage: infer_bbox_shape(boxes) and returns: height,  width