Closed laserkelvin closed 2 years ago
Thanks @laserkelvin! We renamed u
to ._control
as a quick fix. We are still planning to extend DataControl
to be more flexible in the future (passing for example "trajectory" controls for Neural Controlled Differential Equations).
Bug description
The
NeuralODE
class fails to run when passing an abstractVectorField
that just so happens to have a layer or submodule namedu
.On this line, the
_prep_integration
function checks for children of the vector field for au
module, and modifies it expecting something completely different.Attempting to run the
forward
method ofNeuralODE
will trigger this partially unhelpful exception, which makes you think it's atorch
problem:Step to Reproduce
Steps to reproduce the behavior:
u
:NeuralODE
, and callforward
with any arguments:Expected behavior
There shouldn't be a collision with the
NeuralODE
namespace; I suggest renaming the expected object that_prep_integration
looks for to be "private", i.e.hasattr(module, "_u")
just to minimize the chance of this happening, or renaming it to something more descriptive.If you rename
self.u
toself._u
inSimpleMLP
above, the code works.Additional context
This bug exists as of
torchdyn==1.0
, and remains on main branch (per my permalink to the Git).