__init__.py 文件源码

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

项目:theanomodels 作者: clinicalml 项目源码 文件源码
def _getHe2015(self, shape):
        #http://cs231n.github.io/neural-networks-2/
        if len(shape)==1:
            return np.random.normal(0,self.params['init_weight'],shape).astype(config.floatX)
        initializer = 'uniform'
        if self.params['nonlinearity']=='relu':
            K = np.sqrt(2./float((1+self.params['leaky_param']**2)*(shape[0])))
        else:
            K = np.sqrt(1./float(shape[0]))

        if initializer=='uniform':
            return np.random.uniform(-K,K,shape).astype(config.floatX)
        elif initializer=='normal':
            return np.random.normal(0,K,shape).astype(config.floatX)
        else:
            assert False,'Invalid initializer in _getXavierWeight'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号