Skip to content

Trivial dynamic shapes #14700

Answered by jakevdp
awav asked this question in Q&A
Feb 27, 2023 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

No, dynamic shapes are not yet supported, even trivial ones that you mention (in practice, this is not so trivial to implement!) You linked to #14634, I think that's probably the place to follow for updates.

Regarding lax.dynamic_update_slice, it does support dynamic indices, but not dynamic array shapes. This is in contrast to lax.slice, which does not support dynamic indices at all, e.g.

import jax

@jax.jit
def get_slice(x, i):  # note: i is dynamic
  # return jax.lax.slice(x, [i], [i + 3])  # this would fail
  return jax.lax.dynamic_slice(x, [i], [3])  # this succeeds

get_slice(jax.numpy.arange(5), 2)

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@awav
Comment options

@jakevdp
Comment options

@awav
Comment options

@jakevdp
Comment options

@awav
Comment options

Answer selected by awav
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