Hdf5Sample: Store string vectors as "S" dtype instead of obj

master
Alinson S. Xavier 4 years ago
parent c513515725
commit 865a4b2f40
No known key found for this signature in database
GPG Key ID: DCA0DAD4D2F58624

@ -247,8 +247,16 @@ class Hdf5Sample(Sample):
if value is None:
return
self._assert_is_vector(value)
modified = [v if v is not None else "" for v in value]
self._put(key, modified, compress=True)
for v in value:
if isinstance(v, str):
value = np.array(
[u if u is not None else b"" for u in value],
dtype="S",
)
break
self._put(key, value, compress=True)
@overrides
def put_vector_list(self, key: str, value: VectorList) -> None:

Loading…
Cancel
Save