code: def validate_bbox(boxes: torch.Tensor) -> bool:
      """Validate if a 2D bounding box usable or not. This function checks if the boxes are rectangular or not.
  
      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.
      """
      if not (
          len(boxes.shape) in [3, 4]
          and boxes.shape[-2:] == torch.Size([4, 2])
      ):
          raise AssertionError(
              f"Box shape must be (B, 4, 2) or (B, N, 4, 2). Got {boxes.shape}."
          )
  
      if len(boxes.shape) == 4:
          boxes = boxes.view(-1, 4, 2)
  
      if not torch.allclose(
          (boxes[:, 1, 0] - boxes[:, 0, 0] + 1),
          (boxes[:, 2, 0] - boxes[:, 3, 0] + 1),
          atol=1e-4,
      ):
          raise ValueError(
              f"Boxes must have be rectangular, while get widths {boxes[:, 1, 0] - boxes[:, 0, 0] + 1!s}"
              f" and {boxes[:, 2, 0] - boxes[:, 3, 0] + 1!s}"
          )
  
      if not torch.allclose(
          (boxes[:, 2, 1] - boxes[:, 0, 1] + 1),
          (boxes[:, 3, 1] - boxes[:, 1, 1] + 1),
          atol=1e-4,
      ):
          raise ValueError(
              f"Boxes must be rectangular, while getting heights {boxes[:, 2, 1] - boxes[:, 0, 1] + 1!s}"
              f" and {boxes[:, 3, 1] - boxes[:, 1, 1] + 1!s}"
          )
  
      return True
  
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 1 for calling a global function with example usage: validate_bbox(boxes) and returns: True