def __conv(self, input, kernel, strides=[1, 1, 1, 1], nonlinearity=True, batch_norm=True, name="conv"):
with tf.variable_scope(name) as scope:
kernel = tf.get_variable('weights',
shape=kernel,
initializer=xavier_initializer(
dtype=tf.float32),
dtype=tf.float32)
conv = tf.nn.conv2d(input, kernel, strides, padding='SAME')
if batch_norm:
conv = self.__batch_norm_wrapper(conv)
if nonlinearity:
conv = tf.nn.elu(conv, name=scope.name)
return conv
评论列表
文章目录