ENH: input_img_norm = (input_img.ravel() * input_img.ravel()).sum() -> input_img_norm = np.dot(input_img.ravel(), input_img.ravel())