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

Should self.update_states(), self.compute_current(), and self.init_states() be staticmethod? #508

Open
michaeldeistler opened this issue Nov 15, 2024 · 3 comments

Comments

@michaeldeistler
Copy link
Contributor

Currently, all of the above methods are not typically defined to be static. This can lead users to think that they can just use self.channel_params to obtain the parameters in def update_states().

To avoid this misuse, we could just mark all of these methods as static (at least in the tutorials) and thereby allow them to not have any global state.

@michaeldeistler
Copy link
Contributor Author

michaeldeistler commented Nov 15, 2024

Another option would be to just del channel.channel_params after they have been copied over to self.nodes

@jnsbck
Copy link
Contributor

jnsbck commented Nov 19, 2024

I prefer the 2nd option, since they are already contained in nodes.

@jnsbck
Copy link
Contributor

jnsbck commented Dec 12, 2024

init_states cannot be jitted since it acts on nodes. @michaeldeistler and I discussed changing it to sth. like.

cell.to_jax()
cell.init_states()
v = jx.integrate(cell)

this would allow:

cell.to_jax()

@jax.jit
def simulate():
    cell.init_states()
    v = jx.integrate(cell)
    return v

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

No branches or pull requests

2 participants