Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't swallow errors with RNG keys in parameter initialisers. #706

Closed
wants to merge 0 commits into from

Conversation

copybara-service[bot]
Copy link

Don't swallow errors with RNG keys in parameter initialisers.

Given the following code snippet:

def f(x):
  x = hk.Conv2D(3, 1)(x)
  return x

f = hk.transform(f)
x = jnp.ones([1, 28, 28])
f.init(None, x)

At HEAD we fail with a confusing error:

ValueError: Parameters cannot be `None`.

After this change we fail with a far more useful:

MissingRNGError: You must pass a non-None PRNGKey to init and/or apply if you
make use of random numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants