google-deepmind / google-deepmind/chex
Improve assert_shape error message when Ellipsis is used as shape matcher
- Dominant language
- Python
- Stars
- 957
- Forks
- 74
- Avg merge
- 21h 10m
- Merged PRs (30d)
- 1
Description
Using `chex.assert_shape(x, ...)` raises:
AssertionError: expected shapes should be a list or tuple of ints, got Ellipsis
However, Ellipsis works when wrapped in a tuple:
chex.assert_shape(x, (...,))
This makes it unclear whether `...` is unsupported or just incorrectly formatted.
Suggested improvement:
Clarify the error message to indicate a shape specification must be a sequence and suggest using `(...,)`.
Example improved message:
Expected a shape specification tuple, e.g. (...,) instead of bare Ellipsis (...)
Why this helps:
Users commonly interpret `...` as a valid wildcard shape and the current message implies a type mistake rather than guiding correct usage.
Contributor guide
Assessment
This issue has not been assessed yet.