resnet.py 文件源码

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

项目:dl-papers 作者: 4Catalyzer 项目源码 文件源码
def scalar_gating(
    net,
    activation=tf.nn.relu,
    k_initializer=tf.ones_initializer(),
    k_regularizer=None,
    k_regularizable=False,
):
    # Represent this with shape (1,) instead of as a scalar to get proper
    # parameter count from tfprof.
    k = tf.get_variable(
        'k',
        (1,),
        initializer=k_initializer,
        regularizer=k_regularizer,
        trainable=True,
    )

    # Per the paper, we may specifically not want to regularize k.
    k.regularizable = k_regularizable

    return activation(k) * net
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号