def box_area(boxes):
            """
            Computes the area of a set of bounding boxes, which are specified by their
            (x1, y1, x2, y2) coordinates.

            Args:
                boxes (Tensor[N, 4]): boxes for which the area will be computed. They
                    are expected to be in (x1, y1, x2, y2) format with
                    ``0 <= x1 < x2`` and ``0 <= y1 < y2``.

            Returns:
                Tensor[N]: the area for each box
            """
            if "float" in boxes.dtype:
                boxes = boxes.cast('float64')
            elif "int" in boxes.dtype:
                boxes = boxes.cast('int64')

            boxes = boxes
            return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])

            Computes the area of a set of bounding boxes, which are specified by their
            (x1, y1, x2, y2) coordinates.

            Args:
                boxes (Tensor[N, 4]): boxes for which the area will be computed. They
                    are expected to be in (x1, y1, x2, y2) format with
                    ``0 <= x1 < x2`` and ``0 <= y1 < y2``.

            Returns:
                Tensor[N]: the area for each box
            
contrib/SegmentAnything/segment_anything/automatic_mask_generator.py