示例#1
0
文件: nn.py 项目: x724/cgt
def dropout(x, p=0):
    if p == 0:
        return x
    else:
        mask = cgt.greater(cgt.rand(*cgt.shape(x)), p)
        x = x * mask
        x = x / (1.0 - p)
        return x
示例#2
0
文件: nn.py 项目: EdsterG/cgt
def dropout(x, p=0):
    if p==0: 
        return x
    else:
        mask = cgt.greater(cgt.rand(*cgt.shape(x)), p)
        x = x * mask
        x = x /(1.0-p)
        return x