constraints.py 文件源码

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

项目:braindecode 作者: robintibor 项目源码 文件源码
def apply(self, model):
        last_weight = None
        for name, module in list(model.named_children()):
            if hasattr(module, 'weight') and (
                    not module.__class__.__name__.startswith('BatchNorm')):
                module.weight.data = th.renorm(module.weight.data,2,0,maxnorm=2)
                last_weight = module.weight
        if last_weight is not None:
            last_weight.data = th.renorm(last_weight.data,2,0,maxnorm=0.5)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号