tutorials icon indicating copy to clipboard operation
tutorials copied to clipboard

[BUG] - UserWarning: Using torch.cross without specifying the dim arg is deprecated.

Open njzjz opened this issue 1 year ago • 1 comments

Add Link

https://pytorch.org/tutorials/beginner/introyt/tensors_deeper_tutorial.html

Describe the bug

image

/var/lib/workspace/beginner_source/introyt/tensors_deeper_tutorial.py:462: UserWarning:

Using torch.cross without specifying the dim arg is deprecated.
Please either pass the dim explicitly or simply use torch.linalg.cross.
The default value of dim will change to agree with that of linalg.cross in a future release. (Triggered internally at ../aten/src/ATen/native/Cross.cpp:62.)

Describe your environment

I don't actually run it but find the web page has such a warning.

njzjz avatar Jun 14 '24 22:06 njzjz

Hi, after checking on this bug, there are a few things that I noted here:

  1. While torch.cross is more flexible and allows you for more complex cross products, I believe the expected behavior is usually the one from torch.linalg.cross implementation. In this discussion it explains why blindly using torch.cross can lead you to an intersting bug-hunting.
  2. The function torch.svd is deprecated and will be removed in future pytorch release.

I am submitting a PR to attempt to solve this issue and updating the tutorial.

ignaciobartol avatar Jun 28 '24 09:06 ignaciobartol