Repository navigation
Commit 4bda6bb
committed
fix(router): raise ValueError for scalar embedding input instead of IndexError
Fixes #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 list1 parent 813821e commit 4bda6bb
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
105 | 111 | | |
106 | 112 | | |
107 | 113 | | |
| |||
0 commit comments