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

unravel_pytree not functioning on integer input #6135

Closed
dulacarnold opened this issue Mar 19, 2021 · 0 comments · Fixed by #6136
Closed

unravel_pytree not functioning on integer input #6135

dulacarnold opened this issue Mar 19, 2021 · 0 comments · Fixed by #6136
Assignees
Labels
bug Something isn't working

Comments

@dulacarnold
Copy link

dulacarnold commented Mar 19, 2021

Hi Jax-team,

There is a bug related to vjp of the flatten operation and integer input:

pt = {'foo': jnp.array([1,2,3]), 'bar': {'baz': jnp.array([5,6]), 'bork': jnp.array([7,8])}}
flat, unflatten = jax.flatten_util.ravel_pytree(pt)
unflatten(flat)

returns

{'bar': {'baz': array([(b'',), (b'',)], dtype=[('float0', 'V')]),
  'bork': array([(b'',), (b'',)], dtype=[('float0', 'V')])},
 'foo': array([(b'',), (b'',), (b'',)], dtype=[('float0', 'V')])}

This is only if I provide integer input. A proposed fix by @mattjj would be to recast to float and raise a warning, we agreed I would file a bug here.

All the best!

Gabe

@dulacarnold dulacarnold added the bug Something isn't working label Mar 19, 2021
@mattjj mattjj self-assigned this Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants