Repository navigation
Commit a03e323
fix: Infer the tensor type from retrieved values in to_tensor
to_tensor decides between a torch.Tensor and a plain list by looking at
the first value that is not None, but it searches the list where the
missing values have already been replaced by default_value. That default
is float('nan') by default, which is not None, so the search always
returns the first element.
When the first entity row is missing, the type is then read off the
default rather than off the feature. A string feature whose first row is
absent, the ordinary case of an entity key that is not in the online
store, raises 'Failed to convert values for ... to tensor: new():
invalid data type' instead of returning the list the docstring promises.
Reordering the entity rows makes the error disappear.
Read the first present value from the retrieved list. The fallback stays
default_value so that a fully missing numeric feature keeps taking the
tensor path, which the added regression test pins.
Signed-off-by: Rodrigo-Palma <[email protected]>1 parent f9dcfb5 commit a03e323
2 files changed
Lines changed: 55 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
137 | 141 | | |
138 | | - | |
139 | 142 | | |
140 | 143 | | |
141 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments