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

BUG: .data_set() function does not work with vectors #573

Open
ntolley opened this issue Jan 29, 2025 · 3 comments · May be fixed by #574
Open

BUG: .data_set() function does not work with vectors #573

ntolley opened this issue Jan 29, 2025 · 3 comments · May be fixed by #574

Comments

@ntolley
Copy link
Contributor

ntolley commented Jan 29, 2025

Fairly easy to reproduce, if you try to pass a vector for data_set() you get the following:

import jaxley as jx
import numpy as np
from jaxley.channels import Na

cell = jx.Cell()
cell.insert(Na())
net = jx.Network([cell for _ in range(5)])
param_state = None
param_state = net.data_set('Na_gNa', np.repeat(1.0, 5), param_state)
net.record('v')
s = jx.integrate(net, t_max=10, param_state=param_state)
ValueError: Incompatible shapes for broadcasting: (5, 1) and requested shape (1, 5)

Seems like a simple enough change, will open a PR to try and fix this

@ntolley ntolley changed the title .data_set() function does not work with vectors BUG: .data_set() function does not work with vectors Jan 29, 2025
@ntolley
Copy link
Contributor Author

ntolley commented Jan 29, 2025

Also I should note this isn't fixed by reshaping the input vector

@ntolley ntolley linked a pull request Jan 29, 2025 that will close this issue
@michaeldeistler
Copy link
Contributor

Thanks! @kyralianaka aren't you using something like this?

@kyralianaka
Copy link
Contributor

Yes I wrote about this a while ago (#430) , but then I just switched to using select and make_trainable when parameter sharing was made possible that way. I agree that this would be nice to fix if we want to keep supporting data_set().

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

Successfully merging a pull request may close this issue.

3 participants