torch meshgrid warning: in an upcoming release, it will be required to pass the indexing argument
Asked Answered
S

3

9

I am trying to execute LIIF(https://github.com/yinboc/liif) and the following warning appears:

/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]
Skysweeper answered 28/1, 2022 at 9:1 Comment(3)
That a warning, not an error.Music
You need to add a parameter "indexing". Either "indexing" is "xy" or "ij". Take a look => pytorch.org/docs/stable/generated/torch.meshgrid.html.Underwing
change it to 'return _VF.meshgrid(tensors, **kwargs, indexing="ij")'Zoa
Z
6

Change it to

return _VF.meshgrid(tensors, **kwargs, indexing="ij")
Zoa answered 23/3, 2023 at 0:22 Comment(0)
B
1

My answer might not be the direct solution, but can be somehow relevant. I met the same warning but it was caused by calling 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]

From my personal experience, I could not find any relatives between _VF.cartesian_prod and meshgrid, but the warning is there. Some other guys have encountered this, and see pytorch issue #50276. The engineer from Pytorch promised to take a look at it, but I guess they may ignore (or perhaps forget) this.

So I believe this may not be a serious problem and hinder the usage of Pytorch. Just go ahead with it and see whether in the future release, any new arguments (e.g., index) are needed.

Bridgehead answered 9/9, 2022 at 13:5 Comment(0)
T
0

I changed the pytorch version to 22.10 nvcr.io/nvidia/pytorch:22.10-py3 and it helped to resolve the issue. It appeared while I was training yolov8.

Talapoin answered 25/12, 2023 at 4:34 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.