参考链接:https://gist.github.com/ptrblck/4dfd97f487c469d01a4aa8d738c893ea
关键代码:
criterion=nn.NLLLoss(reduce=False) loss=criterion(output,target) loss=loss*weights loss=loss.sum()/weights.sum()

参考链接:https://gist.github.com/ptrblck/4dfd97f487c469d01a4aa8d738c893ea
关键代码:
criterion=nn.NLLLoss(reduce=False) loss=criterion(output,target) loss=loss*weights loss=loss.sum()/weights.sum()
上一篇 python基础之深浅拷贝、列表推导式、排序查找算法、元组、字典
下一篇 CentOS7 yum 时报错 curl#6 - “Could not resolve host: mirror.lzu.edu.cn; Unknown error“ 及telnet安装