generative_inpainting icon indicating copy to clipboard operation
generative_inpainting copied to clipboard

question about gated convolution?

Open zhengbowei opened this issue 4 years ago • 0 comments

     Hello, author, I have some questions about gated convolution, hope to answer!
     In your paper, there is no bias in its formula (i.e. sigmoid (Gatingy,x)), so the probability value of the missing area after sigmoid is 0, which can shield the invalid value of the missing area. 
     But I read your code, and the bias default is biased, so the probability of the missing area is not 0. Isn't it impossible to shield?

    The code of gated convolution is as follows, Please pay attention to “tf.layers.conv2d”

def gen_conv(x, cnum, ksize, stride=1, rate=1, name='conv', padding='SAME', activation=tf.nn.elu, training=True): assert padding in ['SYMMETRIC', 'SAME', 'REFELECT'] if padding == 'SYMMETRIC' or padding == 'REFELECT': p = int(rate*(ksize-1)/2) x = tf.pad(x, [[0,0], [p, p], [p, p], [0, 0]], mode=padding) padding = 'VALID' x = tf.layers.conv2d( x, cnum, ksize, stride, dilation_rate=rate, activation=None, padding=padding, name=name) if cnum == 3 or activation is None: # conv for output return x x, y = tf.split(x, 2, 3) x = activation(x) y = tf.nn.sigmoid(y) x = x * y return x

    And the bias default of tf.layers.conv2d is as follows, Please pay attention to “use_bias=True”

def conv2d(inputs, filters, kernel_size, strides=(1, 1), padding='valid', data_format='channels_last', dilation_rate=(1, 1), activation=None, use_bias=True, kernel_initializer=None, bias_initializer=init_ops.zeros_initializer(), kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None, trainable=True, name=None, reuse=None):

      Finally, wish you all the best, good job and good body!!

zhengbowei avatar Dec 26 '20 02:12 zhengbowei