Task: Image Resizing with Bilinear Interpolation
Implement bilinear_resize(image, new_height, new_width). image is a 2D grayscale (H×W) or 3D RGB (H×W×3) nested list or array.
- Source coordinates of output pixel (i,j): y=i⋅H/Hout and x=j⋅W/Wout (plain scaling: no half-pixel offset, no align-corners).
- Neighbours: y0=⌊y⌋, x0=⌊x⌋, y1=min(y0+1,H−1), x1=min(x0+1,W−1); weights dy=y−y0, dx=x−x0.
- Value, computed in floating point and per channel for RGB:
(1−dx)(1−dy)I[y0,x0]+dx(1−dy)I[y0,x1]+(1−dx)dyI[y1,x0]+dxdyI[y1,x1]
Return the resized image as a nested Python list with the same number of dimensions as the input and every value rounded to 2 decimal places. Both upscaling and downscaling must work.