lezcano / geotorch

Constrained optimization toolkit for PyTorch
https://geotorch.readthedocs.io
MIT License
648 stars 33 forks source link

Annoying warning in Pytorch 1.12. #45

Open pglez82 opened 3 months ago

pglez82 commented 3 months ago

Hi. I am using your library using PyTorch 1.10. It works great! One of my colleagues updated to PyTorch 1.12, and the library still works but, it fills the console with logs that are related with geotorch.

Variable.execution_engine.run_backward( # Calls into the C++ engine to run the backward pass /pathtomyenvironment/python3.9/site-packages/geotorch/so.py:83: UserWarning: An output with one or more elements was resized since it had shape [114, 17, 17], which does not match the required output shape [1, 114, 17, 17]. This behaviour is deprecated, and in a future PyTorch release outputs will not be resized unless they have zero elements. You can explicitly reuse an out tensor t by resizing it, inplace, to zero elements with t.resize(0). (Triggered internally at /opt/conda/conda-bld/pytorch_1659484775609/work/aten/src/ATen/native/Resize.cpp:24.)

I do not know if it is my fault, with this extra tensor dimension that it is complaining about, but the reality is that everything works and with PyTorch 1.10 no warning at all is shown.

lezcano commented 3 months ago

Hi Pablo! I'm afraid I'm going to need a small reproducer where you hit this issue. For debugging, consider using https://pytorch.org/docs/stable/autograd.html#torch.autograd.detect_anomaly to debug this sort of issues.