import tensorflow as tf


        if padding == "PARTIAL":
            with tf.variable_scope('mask'):
                _, h, w, _ = input.get_shape().as_list()

                slide_window = size[0] * size[1]
                mask = tf.ones(shape=[1, h, w, 1])
                update_mask = tf.layers.conv2d(mask, filters=1, dilation_rate=(dilation, dilation), name='mask' + id,
                                            kernel_size=size, kernel_initializer=tf.constant_initializer(1.0),
                                            strides=stride, padding="SAME", use_bias=False, trainable=False)
                mask_ratio = slide_window / (update_mask + 1e-8)
                update_mask = tf.clip_by_value(update_mask, 0.0, 1.0)
                mask_ratio = mask_ratio * update_mask

            with tf.variable_scope('parconv'):
                x = tf.layers.conv2d(input, filters=channels, name='conv' + id, kernel_size=size, kernel_initializer=init,
                                    strides=stride, padding="SAME", use_bias=False)
                x = x * mask_ratio
                if use_bias:
                    bias = tf.get_variable("bias" + id, [channels], initializer=tf.constant_initializer(0.0))
                    x = tf.nn.bias_add(x, bias)
                return x * update_mask

        if padding == "REFLECT":
            assert size[0] % 2 == 1 and size[1] % 2 == 1, "REFLECTION PAD ONLY WORKING FOR ODD FILTER SIZE.. " + str(size)
            pad_x = size[0] // 2
            pad_y = size[1] // 2
            input = tf.pad(input, [[0, 0], [pad_x, pad_x], [pad_y, pad_y], [0, 0]], "REFLECT")
            padding = "VALID"
        
