Luma AI image pipelines use Gaussian blur kernels to smooth rendered frames before downstream processing. Implement gaussian_kernel(k, sigma) to return a normalized two-dimensional Gaussian kernel of size k x k.
Given an odd positive integer k and a positive floating-point standard deviation sigma, center the kernel at coordinate (0, 0). For each offset (x, y), compute:
G(x, y) = exp(-(x² + y²) / (2 * sigma²))
Normalize every value by the sum of all unnormalized values so that the returned matrix sums to 1.0. Coordinates should range from -(k // 2) through k // 2 in both dimensions. Return a Python list containing k lists, each with k floats. Values are judged with a tolerance of 1e-9.
def gaussian_kernel(k, sigma):