【YOLO问题记录】UserWarning: torch.meshgrid: in an upcoming release,it will be required to pass the......

在pycharm上训练yolo数据集的时候,运行train.py报错:

D:\Applications\anaconda3\envs\pytorch\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\cb\pytorch_1000000000000\work\aten\src\ATen\native\TensorShape.cpp:3484.)
return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]

解决方法:

找到pyrcharm所用的虚拟环境下的functional.py文件,根据报错的提示找到functional的504

加上代码indexing = 'ij'

return _VF.meshgrid(tensors, **kwargs,indexing = 'ij')  # type: ignore[attr-defined]

虽然这好像是torch包里的源码,按道理说不应该改,但是确实问题解决了

参考文章:YOLO UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing a_shieres的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/weixin_51972142/article/details/130664816