Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AssertionError: If using tupled rtol it must have the same length as the tuple y0 #7

Open
JiafengtTang opened this issue Oct 17, 2022 · 2 comments

Comments

@JiafengtTang
Copy link

when I run the training, the "AssertionError: If using tupled rtol it must have the same length as the tuple y0" occurs.

@binvec
Copy link

binvec commented Nov 5, 2022

change line 58-59 in lib/layers/cnf.py:

atol=[self.atol, self.atol] + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.atol,
rtol=[self.rtol, self.rtol] + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.rtol,

to

atol= self.atol + 1e20 * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.atol,
rtol= self.rtol + 1e20 * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.rtol,

@bfs18
Copy link

bfs18 commented Dec 6, 2022

change line 58-59 in lib/layers/cnf.py:

atol=[self.atol, self.atol] + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.atol,
rtol=[self.rtol, self.rtol] + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.rtol,

to

atol= self.atol + 1e20 * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.atol,
rtol= self.rtol + 1e20 * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.rtol,

This is incorrect.

The following code is correct.

            state_t = odeint(
                self.odefunc,
                (z, _logpz) + reg_states,
                integration_times.to(z),
                atol=[self.atol] * 2 + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.atol,
                rtol=[self.rtol] * 2 + [1e20] * len(reg_states) if self.solver in ['dopri5', 'bosh3'] else self.rtol,
                adjoint_atol=self.atol,
                adjoint_rtol=self.rtol,
                method=self.solver,
                options=self.solver_options,
                adjoint_options=self.adjoint_options
            )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants