ops.py 文件源码

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

项目:sampleRNN_ICLR2017 作者: soroushmehr 项目源码 文件源码
def dropout_layer(state_before, use_noise, trng):
    """
    :todo:
        - Fix according to _param
        - Test!

    From Cho's code here:
        https://github.com/nyu-dl/dl4mt-tutorial/blob/master/session2/nmt.py#L45
    """
    proj = tensor.switch(
        use_noise,
        # for training
        state_before * trng.binomial(state_before.shape, p=0.5, n=1,
                                     dtype=state_before.dtype),
        # for validation/sampling
        state_before * 0.5)
    return proj
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号