pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
20.52k stars 3.57k forks source link

[FutureWarning] Fixing warning generated by the use of `torch.cuda.amp.autocast(...)` #9463

Closed drivanov closed 2 days ago

drivanov commented 4 days ago

This PR provides a fix for the warning

 /opt/pyg/pytorch_geometric/test/nn/dense/test_linear.py:177: FutureWarning: `torch.cuda.amp.autocast(args...)` 
is deprecated. Please use `torch.amp.autocast('cuda', args...)` instead.

that appears in the following tests:

test/nn/dense/test_linear.py::test_hetero_linear_amp[None-cpu]
test/nn/dense/test_linear.py::test_hetero_linear_amp[None-cuda:0]
test/nn/dense/test_linear.py::test_hetero_linear_amp[True-cpu]
test/nn/dense/test_linear.py::test_hetero_linear_amp[True-cuda:0]
test/nn/dense/test_linear.py::test_hetero_linear_amp[False-cpu]
test/nn/dense/test_linear.py::test_hetero_linear_amp[False-cuda:0]

and several other places.