Fixed the error in the to_bytes interface example code

This commit is contained in:
liu-yongqi-63 2022-04-08 13:21:40 +08:00
parent 914d0ad86e
commit 7d0054977a
1 changed files with 2 additions and 1 deletions

View File

@ -388,7 +388,8 @@ def to_bytes(array, encoding='utf8'):
>>> text_file_dataset_dir = ["/path/to/text_file_dataset_file"]
>>> dataset = ds.TextFileDataset(dataset_files=text_file_dataset_dir, shuffle=False)
>>> for item in dataset.create_dict_iterator(num_epochs=1, output_numpy=True):
... data = text.to_bytes(item["text"])
... data = text.to_str(item["text"])
... byte_encoded_data = text.to_bytes(data)
"""
if not isinstance(array, np.ndarray):