Commit c6df908
Allow to deserialize an example even if a key exists that wasn't found in the specs.
This matches tf.data's path:
```python
import numpy as np
import tensorflow_datasets as tfds
required_feature = tfds.features.FeaturesDict({
'required': tfds.features.Scalar(dtype=np.str_)
})
optional_feature = tfds.features.FeaturesDict({
'optional': tfds.features.Scalar(dtype=np.str_, optional=True)
})
serialized_element = required_feature.serialize_example({'required': 'hello world'})
optional_feature.deserialize_example(serialized_element)
```
PiperOrigin-RevId: 6909871051 parent fc0c421 commit c6df908
File tree
2 files changed
+8
-13
lines changed- tensorflow_datasets/core
2 files changed
+8
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
| |||
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | 175 | | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 119 | + | |
| 120 | + | |
124 | 121 | | |
125 | 122 | | |
126 | 123 | | |
| |||
0 commit comments