Replies: 1 comment 1 reply
-
The fundamental issue here (as you've probably worked out) is that JAX doesn't support data-dependent shapes, so you can't return a slice of The best approach will depend on what you actually want to do with this output. Thanks for including a MWE like this (that's always very useful!), but I don't think there's enough information here to give suggestions for alternative approaches. For example, it's not clear from your description why you need to return this dynamic slice. What about returning the full updated cache instead of a slice up to |
Beta Was this translation helpful? Give feedback.
-
Hi all,
(below is an MWE for my problem)
I'm trying to operate on an array
cache
by dynamically setting the i-th row of this array to some value.The i-th row is found by locating the next non-zero array to fill with the value
l
.This throws a tracer error
TracerArrayConversionError: The numpy.ndarray conversion method __array__() was called on traced array with shape int32[].
when I try to find
i
. This makes sense, since the value ofi
is not known, but how can I get around this?Other examples simply use a list for the cache, appending instead of indexing with
i
but I think I cannot do this - any ideas?Cheers!
Minimum working example here:
Whilst it is obvious to see why this occurs - I need to be able to do the computation here
Beta Was this translation helpful? Give feedback.
All reactions