def batch_filter3D(input_arr, filters):
    assert input_arr.shape[3] == filters.shape[2]
    num_input = input_arr.shape[0]
    output = np.zeros(input_arr.shape[:3] + (filters.shape[-1],))
    for n in xrange(num_input):
        input1 = input_arr[n]
        for f in xrange(filters.shape[-1]):
            for c in xrange(filters.shape[-2]):
                output[n,:,:,f] += filter2D(input1[...,c].copy(), filters[...,c,f].copy())
    return output
3D filtering (i.e. convolution but without mirroring the filter).
dataset/ETHPy150Open bbabenko/simple_convnet/simple_convnet/helpers.py/batch_filter3D