Skip to content

triu_indices in JAX quite slow #14336

Answered by jakevdp
soraros asked this question in General
Feb 7, 2023 · 1 comments · 9 replies
Discussion options

You must be logged in to vote

When I try your code on a Colab CPU runtime, I find that your JAX version is pretty fast. Can you say more about how you benchmarked this?

_ = jax.block_until_ready(triu_indices(10))
%timeit jax.block_until_ready(triu_indices(10))
# 8.37 µs ± 79.3 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

%timeit np.triu_indices(10)
# 23.3 µs ± 4.3 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

Replies: 1 comment 9 replies

Comment options

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

@soraros
Comment options

@jakevdp
Comment options

@soraros
Comment options

@jakevdp
Comment options

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