diff --git a/TensorFlow/contrib/cv/FQ-GAN_ID1117_for_TensorFlow/ops.py b/TensorFlow/contrib/cv/FQ-GAN_ID1117_for_TensorFlow/ops.py index 12d0f0feb9b06d2b1f8ca920feecfbc43d7c825a..8085ebcb2d8b188aa49b095abf368250d7302d1e 100644 --- a/TensorFlow/contrib/cv/FQ-GAN_ID1117_for_TensorFlow/ops.py +++ b/TensorFlow/contrib/cv/FQ-GAN_ID1117_for_TensorFlow/ops.py @@ -62,7 +62,20 @@ def conv(x, channels, kernel=4, stride=2, pad=0, pad_type='zero', use_bias=True, if pad_type == 'zero': x = tf.pad(x, [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]]) if pad_type == 'reflect': - x = tf.pad(x, [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]], mode='REFLECT') + # x = tf.pad(x, [[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]], mode='REFLECT') + + for i in range(pad_top): + j = (i << 1) + 1 + x = tf.concat([x[:, j:j+1, :, :], x], axis=1) + for i in range(pad_bottom): + j = -((i << 1) + 1) + x = tf.concat([x, x[:, j-1:j, :, :]], axis=1) + for i in range(pad_left): + j = (i << 1) + 1 + x = tf.concat([x[:, :, j:j+1, :], x], axis=2) + for i in range(pad_right): + j = -((i << 1) + 1) + x = tf.concat([x, x[:, :, j-1:j, :]], axis=2) if sn : w = tf.get_variable("kernel", shape=[kernel, kernel, x.get_shape()[-1], channels], initializer=weight_init,