torch meshgrid 警告:在即将发布的版本中,将需要传递索引参数

Pep*_*avo 7 python grid user-warning torch pytorch

我正在尝试执行 LIIF( https://github.com/yinboc/liif ​​) 并出现以下警告:

/usr/local/lib/python3.7/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2157.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Run Code Online (Sandbox Code Playgroud)

Fan*_* WU 0

我的答案可能不是直接的解决方案,但可能有一定的相关性。我遇到了同样的警告,但它是由调用引起的torch.cartesian_prod(*tensors)

/opt/conda/lib/python3.7/site-packages/torch/functional.py:1069: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  /opt/conda/conda-bld/pytorch_1634272168290/work/aten/src/ATen/native/TensorShape.cpp:2157.)return _VF.cartesian_prod(tensors)  # type: ignore[attr-defined]
Run Code Online (Sandbox Code Playgroud)

从我个人的经验来看,我找不到_VF.cartesian_prod和之间的任何亲戚meshgrid,但警告是存在的。其他一些人也遇到过这个问题,请参阅pytorch issues #50276。Pytorch 的工程师承诺会看一下,但我猜他们可能会忽略(或者可能忘记)这一点。

所以我相信这可能不是一个严重的问题并阻碍 Pytorch 的使用。只要继续下去,看看在未来的版本中是否需要任何新参数(例如索引)。