layers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:hourglasstensorlfow 作者: wbenbihi 项目源码 文件源码
def convBlock(inputs, numOut, name = 'convBlock'):
    """
        Create a Convolutional Block Layer for Residual Units
        args:
            inputs : (tf.Tensor)
            numOut : (int) number of output channels
        return :
            tf.Tensor
    """
    # DIMENSION CONSERVED
    with tf.name_scope(name):
        norm_1 = tf.contrib.layers.batch_norm(inputs, 0.9, epsilon=1e-5, activation_fn = tf.nn.relu)
        conv_1 = conv2d(norm_1, int(numOut/2), kernel_size=1, strides=1, pad = 'VALID')
        norm_2 = tf.contrib.layers.batch_norm(conv_1, 0.9, epsilon=1e-5, activation_fn = tf.nn.relu)
        pad = tf.pad(norm_2, np.array([[0,0],[1,1],[1,1],[0,0]]))
        conv_2 = conv2d(pad, int(numOut/2), kernel_size=3, strides=1, pad = 'VALID')
        norm_3 = tf.contrib.layers.batch_norm(conv_2, 0.9, epsilon=1e-5, activation_fn = tf.nn.relu)
        conv_3 = conv2d(norm_3, int(numOut), kernel_size=1, strides=1, pad = 'VALID')
        return conv_3
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号