Skip to content
Discussion options

You must be logged in to vote

In JAX prng keys are used to create random samples. You can find out more about them in this guide.

In Haiku, hk.transform (and the variants of it) produce two functions: init and apply. Both of these functions accept random keys, and Haiku then makes new keys available inside your function via hk.next_rng_key().

You can haiku given rng keys for any purpose you prefer, but typically rng keys are required for init since initial parameter values are random samples, and occasionally needed in apply when you need random samples as part of your forward pass (e.g. for dropout layers).

PS feel free to open haiku specific questions on the dm-haiku github page.

Replies: 1 comment 5 replies

Comment options

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

@tomhennigan
Comment options

@EngineerKhan
Comment options

@tomhennigan
Comment options

@EngineerKhan
Comment options

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