def conv_layer(bottom, shape, name, reuse = DO_SHARE):
with tf.variable_scope(name, reuse = reuse):
# print 'hi'+name,reuse
weights = tf.get_variable('weights', shape, tf.float32, xavier_initializer())
biases = tf.get_variable('bias', shape[-1], tf.float32, tf.constant_initializer(0.0))
conv = tf.nn.conv2d(bottom, weights, [1, 1, 1, 1], padding = 'SAME')
activation = tf.nn.relu(tf.nn.bias_add(conv, biases))
return activation
评论列表
文章目录