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

Fixed failing :doctest_test #294

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions sonnet/src/functional/haiku.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def safe_read_tensor_value(variable):

value = variable.tensor_value
if value is None:
# pylint: disable=implicit-str-concat
raise ValueError("".join((
"Attempted to read a TensorVariable in a context where it has no ",
"value. This commonly happens for one of two reasons:",
Expand All @@ -96,6 +97,7 @@ def safe_read_tensor_value(variable):
"For (2) to read variable values inspect the result of a transformed",
"function (e.g. look at the `params` dictionary returned from ",
"`f.init(..)`).")))
# pylint: enable=implicit-str-concat

return value

Expand Down Expand Up @@ -372,11 +374,11 @@ def transform_with_state(f) -> TransformedWithState:
non-trainable state:

>>> y, state = f.apply(params, state, 3.0)
>>> y.numpy()
>>> float(y.numpy())
3.0

>>> y, state = f.apply(params, state, 6.0)
>>> y.numpy()
>>> float(y.numpy())
5.0

Args:
Expand Down
Loading