Skip to content

How to stack static fields properly? #28901

Answered by jakevdp
uduse asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think jax.tree utilities will help in doing the operation you have in mind, because there is no way to manipulate static metadata via tree flattening. Depending on your real-world case, you might try doing it directly using Python builtins, i.e. something like this:

def stack_fn(*blocks):
  return Block(*zip(*((b.width, b.height, b.name) for b in blocks)))

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@uduse
Comment options

Answer selected by uduse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants