def METHOD_NAME(
    batch: Dict[str, Any], device: device_class, half: bool = False
) -> Dict[str, Any]:
    """
    Ported from
    https://github.com/ultralytics/ultralytics/blob/main/ultralytics/yolo/v8/detect/val.py
    """
    batch["img"] = batch["img"].to(device, non_blocking=True)
    batch["img"] = (batch["img"].half() if half else batch["img"].float()) / 255
    for k in ["batch_idx", "cls", "bboxes"]:
        batch[k] = batch[k].to(device)
    return batch