def _conv(inpOp, nIn, nOut, kH, kW, dH, dW, padType):
global conv_counter
name = 'conv' + str(conv_counter)
conv_counter += 1
with tf.variable_scope(name):
kernel_initializer = tf.truncated_normal_initializer(stddev=1e-2)
conv = tf.layers.conv2d(inpOp,
nOut,
[kH, kW],
strides=[dH, dW],
padding=padType,
data_format=data_format_c,
kernel_initializer=kernel_initializer,
use_bias=False)
biases = tf.get_variable(
'biases', [nOut], tf.float32,
tf.constant_initializer(0.0))
bias = tf.reshape(tf.nn.bias_add(conv, biases, data_format=data_format),
conv.get_shape())
return conv
评论列表
文章目录