def _valid_boxes(self, boxes: Boxes | Tensor) -> Boxes:
        """Validate the boxes shape and ensure to be a Boxes into xyxy mode."""
        if isinstance(boxes, Tensor):
            KORNIA_CHECK_SHAPE(boxes.data, ["K", "4"])
            boxes = Boxes(boxes, mode="xyxy")

        if boxes.mode == "xyxy":
            boxes_xyxy = boxes
        else:
            boxes_xyxy = Boxes(boxes.to_tensor(mode="xyxy"), mode="xyxy")

        return boxes_xyxy
Validate the boxes shape and ensure to be a Boxes into xyxy mode.
kornia/contrib/visual_prompter.py