The following code could do the trick.
def resize_batch(img_batch, resize_width, resize_height):
"""
:params
image: np.array(), shape -> (batch, width, height, channels)
resize_width: The resize width dimension.
resize_height: The resize height dimension.
:returns
array of shape -> (batch, resized_width, resized_height, channels)
"""
batch, original_width, original_height, channel = img_batch.shape
rd_ch = img_batch[:,:,:,0]
gr_ch = img_batch[:,:,:,1]
bl_ch = img_batch[:,:,:,2]
resized_images = np.zeros((batch, resize_width, resize_height, channel), dtype=np.uint8)
x_scale = original_width/resize_width
y_scale = original_height/resize_height
resize_idx = np.zeros((resize_width, resize_height))
resize_index_x = np.ceil(np.arange(0, original_width, x_scale)).astype(int)
resize_index_y = np.ceil(np.arange(0, original_height, y_scale)).astype(int)
resize_index_x[np.where(resize_index_x == original_width)] -= 1
resize_index_y[np.where(resize_index_y == original_height)] -= 1
resized_images[:,:,:,0] = rd_ch[:,resize_index_x,:][:,:,resize_index_y]
resized_images[:,:,:,1] = gr_ch[:,resize_index_x,:][:,:,resize_index_y]
resized_images[:,:,:,2] = bl_ch[:,resize_index_x,:][:,:,resize_index_y]
return resized_images