Interview Guides

Given two NumPy arrays of axis-aligned bounding boxes, boxes1 with shape (N, 4) and boxes2 with shape (M, 4), write a function that returns an (N, M) NumPy array where each entry is the intersection-over-union (IoU) between one box from boxes1 and one box from boxes2. Each box is represented as [x1, y1, x2, y2], where x1 < x2 and y1 < y2.
0 <= N, M <= 10^4boxes1.shape == (N, 4) and boxes2.shape == (M, 4)x1 <= x2 and y1 <= y2