Skip to content

JIT compatible equivalent to segment_sum that concatenates instead of summing? #25183

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

You must be logged in to vote

This looks like a decent enough approach, and should be efficient so long as segment_ids is quite small. If segment_ids is longer, the flattening of the python for loop could lead to prohibitively long compilation times – I'd suggest rewriting that part in a vectorized manner if possible. It seems like it would effectively be a generalization of some of the approaches used in the implementation of jnp.unique.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@jakevdp
Comment options

Answer selected by NiklasKappel
@NiklasKappel
Comment options

@jakevdp
Comment options

@NiklasKappel
Comment options

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