res_auto.py 文件源码

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

项目:dem 作者: hengyuan-hu 项目源码 文件源码
def _deconv_shortcut(x, residual, output_shape):
    # Expand channels of shortcut to match residual.
    # Stride appropriately to match residual (width, height).
    # Should be int if network architecture is correctly configured.
    stride_width = residual._keras_shape[1] / x._keras_shape[1]
    stride_height = residual._keras_shape[2] / x._keras_shape[2]
    equal_channels = residual._keras_shape[3] == x._keras_shape[3]

    shortcut = x
    if stride_width > 1 or stride_height > 1 or not equal_channels:
        shortcut = Deconvolution2D(
            residual._keras_shape[3], 1, 1,
            subsample=(stride_width, stride_height),
            output_shape=output_shape,
            init="he_normal", border_mode="valid")(x)
    return merge([shortcut, residual], mode="sum")


# Builds a residual block with repeating bottleneck blocks.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号