赞
踩
有时候总会有userwarning,虽然不是报错不影响程序运行,但是看着烦
UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
解决方案:
在代码开头:
- import warnings
- warnings.filterwarnings('ignore')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。