GaloisInc / dlkoopman

A general-purpose Python package for Koopman theory using deep learning.
https://pypi.org/project/dlkoopman/
MIT License
80 stars 11 forks source link

UserWarning: An output with one or more elements was resized #8

Closed souryadey closed 1 year ago

souryadey commented 1 year ago

Running StatePred.train_net() results in something like:

UserWarning: An output with one or more elements was resized since it had shape [1, 6, 6], which does not match the required output shape [1, 1, 6, 6]. This behavior 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).
souryadey commented 1 year ago

This occurs on torch<=1.12. It's not an error, it's a warning. Nothing is wrong, so do not worry. Even though Pytorch complains, the matrix shapes are actually perfectly compatible. The results that you get will be perfectly fine.

If you just want to get rid of the message, consider adding the following to your script:

import warnings
warnings.filterwarnings("ignore", category=UserWarning) 

Alternatively, upgrading to torch 1.13 should make the message go away.