Skip to content

TypeError: unhashable type: 'DeviceArray' #10258

Answered by jakevdp
dui1234 asked this question in General
Discussion options

You must be logged in to vote

The issue is you need to pass body_fun to your while loop, rather than the result of evaluating body_fun. Additionally, both body_fun and cond_fun must accept a single value as an argument. It sounds like what you want is to partially evaluate body_fun before passing it to while_loop, e.g.

from functools import partial
lax.while_loop(cond_fun, partial(body_fun, y=y), init_val)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@dui1234
Comment options

@jakevdp
Comment options

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