Skip to content

Commit

Permalink
Fixed failing :doctest_test
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 696436679
  • Loading branch information
superbobry authored and copybara-github committed Nov 14, 2024
1 parent 31d3fdc commit 0b2b20f
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit 0b2b20f

Please sign in to comment.