warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")

问题:

D:\Program Files\Python36_64\lib\site-packages\torch\nn\functional.py:1890: UserWarning: 

nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.

warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead."

 代码:

from torch.nn import functional as F

F.upsample(x, size=(H, W), mode='bilinear',align_corners=True)

错误原因:

python版本问题,python3.5 支持 upsample 函数,python3.6 不支持 upsample 函数

假如我们忽略这个警告,会导致实验效果降低,简单来说,这个警告一定要改

解决办法:

from torch.nn import functional as F

F.interpolate(x, size=(H, W), mode='bilinear', align_corners=True)

 

你可能感兴趣的:(bug)