tfds-nightly 4.9.9.dev202507290047__py3-none-any.whl → 4.9.9.dev202507300045__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tensorflow_datasets/core/utils/conversion_utils.py +12 -0
- tensorflow_datasets/core/utils/conversion_utils_test.py +17 -6
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/METADATA +1 -1
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/RECORD +9 -9
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/WHEEL +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/entry_points.txt +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/licenses/AUTHORS +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/licenses/LICENSE +0 -0
- {tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/top_level.txt +0 -0
@@ -128,6 +128,18 @@ def to_tfds_value(value: Any, feature: feature_lib.FeatureConnector) -> Any:
|
|
128
128
|
match feature:
|
129
129
|
case feature_lib.ClassLabel() | feature_lib.Scalar():
|
130
130
|
return value
|
131
|
+
case feature_lib.Video():
|
132
|
+
match value:
|
133
|
+
case dict():
|
134
|
+
if 'path' in value and value['path']:
|
135
|
+
return value['path']
|
136
|
+
elif 'bytes' in value and value['bytes']:
|
137
|
+
return value['bytes']
|
138
|
+
else:
|
139
|
+
raise ValueError(
|
140
|
+
'Dictionary-like video features must have either a `path` or'
|
141
|
+
' `bytes` key.'
|
142
|
+
)
|
131
143
|
case feature_lib.FeaturesDict():
|
132
144
|
return {
|
133
145
|
name: to_tfds_value(value.get(name), inner_feature)
|
@@ -81,7 +81,7 @@ def test_convert_value_raises(value, feature):
|
|
81
81
|
@pytest.mark.parametrize(
|
82
82
|
'value,feature,expected_value',
|
83
83
|
[
|
84
|
-
#
|
84
|
+
# Datetime.
|
85
85
|
(
|
86
86
|
datetime.datetime(1970, 1, 1, tzinfo=datetime.timezone.utc),
|
87
87
|
feature_lib.Scalar(dtype=np.int64),
|
@@ -92,14 +92,14 @@ def test_convert_value_raises(value, feature):
|
|
92
92
|
feature_lib.Scalar(dtype=np.int64),
|
93
93
|
86400,
|
94
94
|
),
|
95
|
-
#
|
95
|
+
# Scalar.
|
96
96
|
(42, feature_lib.Scalar(dtype=np.int64), 42),
|
97
97
|
(42, feature_lib.Scalar(dtype=np.int32), 42),
|
98
98
|
('abc', feature_lib.Scalar(dtype=np.object_), 'abc'),
|
99
99
|
(True, feature_lib.Scalar(dtype=np.bool_), True),
|
100
100
|
(False, feature_lib.Scalar(dtype=np.bool_), False),
|
101
101
|
(42.0, feature_lib.Scalar(dtype=np.float32), 42.0),
|
102
|
-
#
|
102
|
+
# Sequence.
|
103
103
|
([42], feature_lib.Sequence(feature=tf.int64), [42]),
|
104
104
|
(42, feature_lib.Sequence(feature=tf.int64), [42]),
|
105
105
|
(None, feature_lib.Sequence(feature=tf.int64), []),
|
@@ -111,7 +111,7 @@ def test_convert_value_raises(value, feature):
|
|
111
111
|
),
|
112
112
|
{'someint': [b'', 'string', b'']},
|
113
113
|
),
|
114
|
-
#
|
114
|
+
# Image.
|
115
115
|
(
|
116
116
|
lazy_imports_lib.lazy_imports.PIL_Image.new(mode='L', size=(4, 4)),
|
117
117
|
feature_lib.Image(),
|
@@ -119,7 +119,7 @@ def test_convert_value_raises(value, feature):
|
|
119
119
|
mode='RGB', size=(4, 4)
|
120
120
|
),
|
121
121
|
),
|
122
|
-
#
|
122
|
+
# Dict.
|
123
123
|
(
|
124
124
|
{
|
125
125
|
'de': b'Hallo Welt',
|
@@ -148,7 +148,18 @@ def test_convert_value_raises(value, feature):
|
|
148
148
|
}),
|
149
149
|
{'name': b'Name', 'age': 100},
|
150
150
|
),
|
151
|
-
#
|
151
|
+
# Video.
|
152
|
+
(
|
153
|
+
{'path': 'path/to/video.avi', 'bytes': None},
|
154
|
+
feature_lib.Video(),
|
155
|
+
'path/to/video.avi',
|
156
|
+
),
|
157
|
+
(
|
158
|
+
{'path': None, 'bytes': b'video_bytes'},
|
159
|
+
feature_lib.Video(),
|
160
|
+
b'video_bytes',
|
161
|
+
),
|
162
|
+
# nan, but the feature type is not float.
|
152
163
|
(
|
153
164
|
np.nan,
|
154
165
|
feature_lib.Text(),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: tfds-nightly
|
3
|
-
Version: 4.9.9.
|
3
|
+
Version: 4.9.9.dev202507300045
|
4
4
|
Summary: tensorflow/datasets is a library of datasets ready to use with TensorFlow.
|
5
5
|
Home-page: https://github.com/tensorflow/datasets
|
6
6
|
Download-URL: https://github.com/tensorflow/datasets/tags
|
{tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/RECORD
RENAMED
@@ -243,8 +243,8 @@ tensorflow_datasets/core/utils/benchmark_test.py,sha256=WUls_DapQTGs5P3DYJrcFldS
|
|
243
243
|
tensorflow_datasets/core/utils/bool_utils.py,sha256=299rj0bCG4zytHfsTEbptCV1M0RG_xN6d0SvmQZ1Sg4,1066
|
244
244
|
tensorflow_datasets/core/utils/bool_utils_test.py,sha256=rwFRcYV0wBknvYODjeTgRDqwUifzwLGCwejGdAjo61Q,1559
|
245
245
|
tensorflow_datasets/core/utils/colormap.csv,sha256=DDayUU9R19cxhcG3fj4cFwhI46W20U7ofBG0kToUHOw,2732
|
246
|
-
tensorflow_datasets/core/utils/conversion_utils.py,sha256=
|
247
|
-
tensorflow_datasets/core/utils/conversion_utils_test.py,sha256=
|
246
|
+
tensorflow_datasets/core/utils/conversion_utils.py,sha256=V8kFmJu38op7-8ufZvEn0fLOH8FMkjQebQ1NstIMRYo,6747
|
247
|
+
tensorflow_datasets/core/utils/conversion_utils_test.py,sha256=rP_nbzQWzmZc_GXp3Y6TirwIGJqiQbF-JtY3B1tOuN0,5346
|
248
248
|
tensorflow_datasets/core/utils/croissant_utils.py,sha256=9C8sScaEqSRsThqpQQc48GDNR1KFmDkS8hmKIvfZCB0,5181
|
249
249
|
tensorflow_datasets/core/utils/croissant_utils_test.py,sha256=UdkAVYDTPm1L0zmMESScurV_IMA5K3qAKmL_umeMJZI,4497
|
250
250
|
tensorflow_datasets/core/utils/docs.py,sha256=0AeGyhPXQc_DMsTX7ocbb8IuJv_RTrG7StYdfZiwSzU,1549
|
@@ -2468,10 +2468,10 @@ tensorflow_datasets/vision_language/wit/wit_test.py,sha256=PXS8DMNW-MDrT2p5oy4Ic
|
|
2468
2468
|
tensorflow_datasets/vision_language/wit_kaggle/__init__.py,sha256=vGwSGeM8WE4Q-l0-eEE1sBojmk6YT0l1OO60AWa4Q40,719
|
2469
2469
|
tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle.py,sha256=q-vX_FBzIwsFxL4sY9vuyQ3UQD2PLM4yhUR4U6l-qao,16903
|
2470
2470
|
tensorflow_datasets/vision_language/wit_kaggle/wit_kaggle_test.py,sha256=ZymHT1NkmD-pUnh3BmM3_g30c5afsWYnmqDD9dVyDSA,1778
|
2471
|
-
tfds_nightly-4.9.9.
|
2472
|
-
tfds_nightly-4.9.9.
|
2473
|
-
tfds_nightly-4.9.9.
|
2474
|
-
tfds_nightly-4.9.9.
|
2475
|
-
tfds_nightly-4.9.9.
|
2476
|
-
tfds_nightly-4.9.9.
|
2477
|
-
tfds_nightly-4.9.9.
|
2471
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/licenses/AUTHORS,sha256=nvBG4WwfgjuOu1oZkuQKw9kg7X6rve679ObS-YDDmXg,309
|
2472
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
2473
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/METADATA,sha256=arcclClNnJHMP0IcN-tMf9Z2JwulAu_cPL_XwPx1k4M,11694
|
2474
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
2475
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/entry_points.txt,sha256=eHEL7nF5y1uCY2FgkuYIdE062epJXlAQTSdq89px4p4,73
|
2476
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/top_level.txt,sha256=bAevmk9209s_oxVZVlN6hSDIVS423qrMQvmcWSvW4do,20
|
2477
|
+
tfds_nightly-4.9.9.dev202507300045.dist-info/RECORD,,
|
{tfds_nightly-4.9.9.dev202507290047.dist-info → tfds_nightly-4.9.9.dev202507300045.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|