Skip to content

fix(router): raise ValueError for scalar embedding input instead of I… - #82

Open
wycfirezdog wants to merge 1 commit into
adrida:mainfrom
wycfirezdog:fix/issue-69-scalar-embedding-indexerror
Open

wycfirezdog wants to merge 1 commit into
adrida:mainfrom
wycfirezdog:fix/issue-69-scalar-embedding-indexerror

Conversation

@wycfirezdog

Copy link
Copy Markdown

Router.predict() raised IndexError when given a scalar embedding input. _to_embedding() returned a 0-D numpy array with shape=(), and accessing shape[-1] crashed with IndexError.

Changes:

  • Add ndim == 0 check in _to_embedding()
  • Raise clear ValueError with helpful message for scalar inputs
  • Suggests reshaping to (1, -1) or passing a list

…ndexError

Fixes adrida#69: Router.predict() raised IndexError when given a scalar
embedding input. _to_embedding() returned a 0-D numpy array with
shape=(), and accessing shape[-1] crashed with IndexError.

Changes:
- Add ndim == 0 check in _to_embedding()
- Raise clear ValueError with helpful message for scalar inputs
- Suggests reshaping to (1, -1) or passing a list
@wycfirezdog
wycfirezdog requested a review from adrida as a code owner August 20, 2026 20:48

This branch has not been deployed

No deployments
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.

1 participant