def deconv_layer(bottom, shape, output_shape, name, reuse = DO_SHARE): #doubtful about this
with tf.variable_scope(name, reuse = reuse):
# shape will be in the following form: [height, width, output_channels, input_channels]
weights = tf.get_variable('weights', shape, tf.float32, xavier_initializer())
biases = tf.get_variable('bias', shape[-2], tf.float32, tf.constant_initializer(0.0))
dconv = tf.nn.conv2d_transpose(bottom, weights, output_shape = output_shape, strides = [1, 1, 1, 1], padding='VALID')
activation = tf.nn.relu(tf.nn.bias_add(dconv, biases))
# print(activation.get_shape())
return activation
评论列表
文章目录