Library: scipy==1.9.2 (Python 3.10, released 2022-10)

Problem: 
Complete the function that applies a gaussian filter on batched images (batched in the first dimention), non specified parameters should use the default value

Starting code:
from scipy.ndimage import gaussian_filter
import numpy as np 
def apply_gaussian_filter(A: np.ndarray, sigma: float) -> np.ndarray:
    

Solution:

    output = np.zeros(A.shape)
    for i in range(A.shape[0]):
        output[i] =  gaussian_filter(A[i],sigma=sigma)
    return output

Test:

A = np.array([[[7.81411439e-01, 1.12331105e-02, 9.39679607e-01, 6.42515536e-01,
         6.95548884e-01],
        [4.58001321e-01, 7.90049557e-01, 7.41113873e-01, 9.85894466e-03,
         4.53976568e-01],
        [2.24634401e-01, 4.26973301e-01, 8.91014236e-01, 8.23895514e-01,
         9.31046059e-01],
        [4.45855698e-02, 2.58723740e-02, 3.84879860e-01, 5.52190839e-01,
         8.30264909e-02],
        [9.15445530e-01, 8.36618255e-02, 4.39455188e-01, 1.53462390e-01,
         7.26436401e-01]],

       [[7.28031138e-01, 3.75117422e-01, 5.42310487e-01, 5.63557751e-01,
         2.57909701e-04],
        [7.50931873e-01, 6.15538706e-01, 9.05514875e-01, 8.48424138e-01,
         3.10902901e-01],
        [1.72613108e-01, 7.06317645e-01, 8.89355115e-01, 8.90701413e-02,
         9.28579120e-01],
        [9.80044173e-01, 1.67306937e-01, 1.69314197e-01, 5.09876755e-01,
         7.74652232e-01],
        [5.31016205e-01, 6.71446481e-01, 8.29882594e-02, 1.70589945e-01,
         3.23593050e-01]],

       [[8.38046468e-01, 7.96708042e-03, 9.28662972e-01, 6.75111182e-01,
         3.33247539e-02],
        [9.99455965e-01, 9.41123427e-01, 1.06977786e-01, 1.73786082e-01,
         5.95914076e-01],
        [5.46093501e-01, 4.99303483e-01, 4.60402210e-01, 4.75650259e-02,
         4.58097639e-01],
        [5.15319589e-01, 2.31310779e-01, 1.93670305e-01, 9.76320068e-01,
         8.78819966e-01],
        [1.09356481e-01, 2.16028113e-01, 1.67111833e-01, 9.65726787e-01,
         6.75017369e-01]]])
sigma=2
output = apply_gaussian_filter(A,sigma=sigma)
expect = np.array([
    [
        [0.51107853, 0.52434293, 0.5435481,  0.55983926, 0.56841324],
        [0.48836795, 0.50252599, 0.52348203, 0.54190047, 0.55197513],
        [0.4538848,  0.46817802, 0.49030855, 0.51105784, 0.52313636],
        [0.42268583, 0.43538067, 0.45646669, 0.47802514, 0.49150328],
        [0.40530094, 0.41608726, 0.43533884, 0.45656804, 0.47057292]
    ],
    [
        [0.58159932, 0.567709,   0.54222862, 0.51274141, 0.49237396],
        [0.56988096, 0.55678826, 0.53427875, 0.50995134, 0.49392329],
        [0.54914438, 0.53583943, 0.51580817, 0.49760273, 0.4872573 ],
        [0.52640569, 0.51103919, 0.49059125, 0.47570284, 0.46933531],
        [0.51143711, 0.4938774,  0.47171782, 0.45745161, 0.45266544]
    ],
    [
        [0.56163134, 0.53611524, 0.4985118,  0.46508331, 0.44632982],
        [0.53501922, 0.51740249, 0.49329637, 0.47430703, 0.46497321],
        [0.4887689,  0.48537733, 0.48514968, 0.49115186, 0.49783821],
        [0.43872375, 0.45125797, 0.47730807, 0.51021342, 0.53383157],
        [0.40596121, 0.42914707, 0.47257655, 0.523013,   0.55752451]
    ]
])
assertion_value = np.allclose(output, expect)
assert assertion_value