赞
踩
- # 复制内核权重并获得列式L2规范的排名索引
- kernel_weights = np.copy(k_weights)
- ind = np.argsort(np.linalg.norm(kernel_weights, axis=0))
-
- # 要设置为0的索引数
- sparsity_percentage = 0.7
- cutoff = int(len(ind)*sparsity_percentage)
-
- # 将2D内核权重矩阵中的索引设置为0
- sparse_cutoff_inds = ind[0:cutoff]
- kernel_weights[:,sparse_cutoff_inds] = 0.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。