Skip to content

Commit

Permalink
Improve exception message for assert_tree_shape_prefix.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 427413341
  • Loading branch information
hbq1 authored and ChexDev committed Feb 9, 2022
1 parent e54cc52 commit 37fd407
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chex/_src/asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,9 +943,9 @@ def _assert_prefix_fn(path, leaf):
if len(shape_prefix) > len(leaf.shape):
errors.append(
(f"Tree leaf '{_ai.format_tree_path(path)}' has a shape "
f"of length {len(leaf.shape)} (shape={leaf.shape}) which is smaller "
f"of length {leaf.ndim} (shape={leaf.shape}) which is smaller "
f"than the expected prefix of length {len(shape_prefix)} "
"(prefix={shape_prefix})."))
f"(prefix={shape_prefix})."))
return

suffix = leaf.shape[:len(shape_prefix)]
Expand Down

0 comments on commit 37fd407

Please sign in to comment.