def blur(image, factor):
    'Blur with the same kernel as ImageFilter.BLUR.'
    blur_kernel = (tf.constant([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]], dtype=tf.float32, shape=[5, 5, 1, 1]) / 16.0)
    blurred_im = _convolve_image_with_kernel(image, blur_kernel)
    return blend(image, blurred_im, factor)
Blur with the same kernel as ImageFilter.BLUR.
def blur(image, factor):
    
    blur_kernel = (tf.constant([[1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 0.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0]], dtype=tf.float32, shape=[5, 5, 1, 1]) / 16.0)
    blurred_im = _convolve_image_with_kernel(image, blur_kernel)
    return blend(image, blurred_im, factor)