def METHOD_NAME(self, input, r):
    """
    Convolves an image by a 2D triangle filter (the 1D triangle filter f is
    [1:r r+1 r:-1:1]/(r+1)^2, the 2D version is simply conv2(f,f'))
    """
    if r <= 1:
        raise ValueError(
            '`r` should be greater than 1, but it is {}.'.format(r))
    kernel = [
        list(range(1, r + 1)) + [r + 1] + list(reversed(range(1, r + 1)))
    ]
    kernel = paddle.to_tensor(kernel).astype('float32')
    kernel = kernel / (r + 1)**2
    input_ = F.pad(input, [1, 1, 0, 0], mode='replicate')
    input_ = F.pad(input_, [r, r, 0, 0], mode='reflect')
    input_ = [input_[:, :, :, :r], input, input_[:, :, :, -r:]]
    input_ = paddle.concat(input_, axis=3)
    tem = input_.clone()
    input_ = F.pad(input_, [0, 0, 1, 1], mode='replicate')
    input_ = F.pad(input_, [0, 0, r, r], mode='reflect')
    input_ = [input_[:, :, :r, :], tem, input_[:, :, -r:, :]]
    input_ = paddle.concat(input_, axis=2)
    c = input.shape[1]
    kernel_x = paddle.concat([kernel.unsqueeze((0, 1))] * c, axis=0)
    output = F.conv2d(input_, kernel_x, padding=0, groups=c)
    kernel_y = paddle.concat([kernel.t().unsqueeze((0, 1))] * c, axis=0)
    output = F.conv2d(output, kernel_y, padding=0, groups=c)
    return output