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

tm.unwrap: Error when out_vectors is list [documentation] #16

Open
deasmhumhna opened this issue Nov 10, 2022 · 1 comment
Open

tm.unwrap: Error when out_vectors is list [documentation] #16

deasmhumhna opened this issue Nov 10, 2022 · 1 comment

Comments

@deasmhumhna
Copy link

import jax.numpy as jnp 
import tree_math as tm

def f(x, y):
  return x, y
  
x = y = tm.Vector(jnp.array(0.))

tm.unwrap(f, out_vectors = (True, False))(x, y)
# (tree_math.Vector(DeviceArray(0., dtype=float32, weak_type=True)), DeviceArray(0., dtype=float32, weak_type=True))
tm.unwrap(f, out_vectors = [True, False])(x, y)
# ValueError: Expected list, got (DeviceArray(0., dtype=float32, weak_type=True), DeviceArray(0., dtype=float32, weak_type=True)).
@deasmhumhna deasmhumhna changed the title tm.unwrap: Error when out_vectors is list tm.unwrap: Error when out_vectors is list [documentation] Nov 10, 2022
@deasmhumhna
Copy link
Author

This is definitely just due to a lack of documentation since out_vectors has to be a pytree with the same structure as the return value.

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

1 participant