tksmatsubara / symplectic-adjoint-method

Code for "Symplectic Adjoint Method for Exact Gradient of Neural ODE with Minimal Memory," NeurIPS, 2021.
14 stars 3 forks source link

ImportError: cannot import name 'MidpointSolver' #1

Closed yaomz16 closed 2 years ago

yaomz16 commented 2 years ago

Hi, I'm trying to use this package and encountered the following problem:

from torch_symplectic_adjoint import symplectic_adjoint

Traceback (most recent call last): File "", line 1, in File "/jet/home/mingzeya/tools/symplectic-adjoint-method/torch_symplectic_adjoint/init.py", line 1, in from ._impl import odeint File "/jet/home/mingzeya/tools/symplectic-adjoint-method/torch_symplectic_adjoint/_impl/init.py", line 1, in from .odeint import odeint File "/jet/home/mingzeya/tools/symplectic-adjoint-method/torch_symplectic_adjoint/_impl/odeint.py", line 10, in from .integrators.midpoint import MidpointSolver ImportError: cannot import name 'MidpointSolver' from 'torch_symplectic_adjoint._impl.integrators.midpoint' (/jet/home/mingzeya/tools/symplectic-adjoint-method/torch_symplectic_adjoint/_impl/integrators/midpoint.py)

Is there circular dependency existing in the package?

tksmatsubara commented 2 years ago

Thank you for your comment. This is due to a typo I made when I refactored the code for the release.

MidpointSolver -> MidPointSolver

In addition, I found other typos in the class names to be imported.

symplectic_adjoint -> odeint_symplectic_adjoint

I fixed the typos in the latest commit. Could you please retry our code? Sorry for the inconvenience.

yaomz16 commented 2 years ago

Thanks so much for fixing this issue, the function can now be imported properly.