Closed gautierronan closed 1 year ago
Base: 62.53% // Head: 62.63% // Increases project coverage by +0.09%
:tada:
Coverage data is based on head (
c068b2b
) compared to base (201026a
). Patch coverage: 90.00% of modified lines in pull request are covered.
:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Actually, thinking more on this, I'm not sure what's the best practice. Should tspan
stay complex-valued to keep every object in the model of the same type? Or should it be real-valued for consistency?
I'm unsure of what's best... I'll let the maintainers decide!
Thanks for contributing! It makes sense to keep t
real-valued. We don't really have any particular use case at the moment where it becomes convenient to keep x
and t
of the same dtype
.
Following up on my PR https://github.com/DiffEqML/torchdyn/pull/178 and on this issue https://github.com/DiffEqML/torchdyn/issues/177.
In the current state of
odeint
, the time valuest
are complex-valued ifx
is initially complex-valued when callingf(t, x)
at every time step. Instead, they should be float like. Otherwise, this could be problematic iff(t, x)
requires real-valued times (e.g. iff(t, x) = torch.erf(t) * x
).This PR fixes this by making changes to the
solver.tableau
definitions. Thec
constants in the tableaus are initialized with a float dtype of the same precision as the (complex or float) dtype ofx
. This is done by callingt_dtype = getattr(torch, torch.finfo(x.dtype).dtype)
. Ifx
is float-valued, thent_dtype = x.dtype
and things work as usual. Changes insync_device_dtype
were also required to differentiate between thet.dtype
and thex.dtype
.Sorry for having missed this in the initial PR !