导读
在使用pytorch训练的时候报一堆的UserWarning
,报错信息如下
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
/pytorch/aten/src/ATen/native/IndexingUtils.h:20: UserWarning: indexing with dtype torch.uint8 is now deprecated, please use a dtype torch.bool instead.
- 环境信息
pytorch:1.3.1
torchvision:0.4.2
cuda:10.0
cudnn:7.6.5
解决办法
在train.py
导入报上加入下面两句话
import warnings
warnings.filterwarnings("ignore", category=UserWarning)
过滤掉这些警告信息就行了