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

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

Starting code:
from scipy.ndimage import uniform_filter
import numpy as np 
def apply_uniform_filter(A: np.ndarray, size: int) -> np.ndarray:
    

Solution:

    output = np.zeros(A.shape)
    for i in range(A.shape[0]):
        output[i] =  uniform_filter(A[i], size=size)
    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]]])
size=3
output = apply_uniform_filter(A,size=size)
expect = np.array([
    [
        [0.53935158, 0.60597923, 0.52531988, 0.6400486,  0.55389319],
        [0.4618167,  0.58490121, 0.5862593,  0.68096102, 0.62637922],
        [0.2997042,  0.44301383, 0.51620539, 0.54122249, 0.48022706],
        [0.32287094, 0.38183581, 0.42015617, 0.55393411, 0.55672963],
        [0.43823881, 0.37027365, 0.25734465, 0.40653391, 0.43676824]
    ],
    [
        [0.64219576, 0.61810039, 0.59238323, 0.47523269, 0.28870856],
        [0.55556956, 0.63174782, 0.61502292, 0.56421916, 0.44228132],
        [0.5884824,  0.59521518, 0.54452428, 0.60285439, 0.60840439],
        [0.54582423, 0.48560024, 0.3840295,  0.43755765, 0.53590952],
        [0.62159479, 0.43195191, 0.29961636, 0.28979841, 0.41052592]
    ],
    [
        [0.70090615, 0.62187891, 0.49392997, 0.46120842, 0.31657062],
        [0.69062065, 0.59200365, 0.42676658, 0.38664908, 0.34123725],
        [0.64371953, 0.49929523, 0.40338435, 0.4323948,  0.56259273],
        [0.3653535,  0.3265107,  0.41749318, 0.53585902, 0.66816465],
        [0.23682579, 0.2139215,  0.45544829, 0.62939137, 0.81838701]
    ]
])
assertion_value = np.allclose(output, expect)
assert assertion_value