functions.py 文件源码

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

项目:Conceptors 作者: CogSciUOS 项目源码 文件源码
def IntWeights(N, M,connectivity):    

    succ = False
    while not succ:    
        try:
            W_raw =  sparse.rand(N, M ,format='lil', density=connectivity )
            rows,cols = W_raw.nonzero()
            for row,col in zip(rows,cols):
                W_raw[row,col] = np.random.randn()
            specRad,eigenvecs = np.abs(lin.eigs(W_raw,1))
            W_raw =  np.squeeze(np.asarray(W_raw/specRad))
            succ = True
            return W_raw
        except:
            pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号