在pycharm运行yoloV5中的train.py时遇到
F:\depth_study\anaconda\envs\pytorch\Lib\site-packages\torch\functional.py:513: 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:3610.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
解决方法:
先点击F:\depth_study\anaconda\envs\pytorch\Lib\sitepackages\torch\functional.py:513
(这个看你电脑上的警告位置),位置会出现下列代码:
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
将其改为
return _VF.meshgrid(tensors, **kwargs,indexing = 'ij') # type: ignore[attr-defined]
应该可以解决当前问题
解析问题:
这个警告的意思是当前的代码格式会与将来的pytorch版本不兼容,考虑到代码的可移植性,建议修改