mindspore/docs/api/api_python/dataset/mindspore.dataset.serialize...

22 lines
1.1 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.dataset.serialize
============================
.. py:function:: mindspore.dataset.serialize(dataset, json_filepath='')
将数据处理管道序列化成JSON文件。
.. note::
目前不支持对Python对象进行完整的序列化。不支持的场景包括数据管道中使用了 `GeneratorDataset` 或包含自定义Python函数的 `map``batch` 操作。
对于Python对象序列化操作不会得到完整的对象内容这意味着对序列化得到的JSON文件进行反序列化时可能会导致错误。
例如对自定义Python函数Python user-defined functions的数据管道进行序列化时会出现相关警告提示并且得到的JSON文件不能被反序列化为可用的数据管道。
参数:
- **dataset** (Dataset) - 数据处理管道对象。
- **json_filepath** (str) - 生成序列化JSON文件的路径。默认值 ''不指定JSON路径。
返回:
Dict包含序列化数据集图的字典。
异常:
- **OSError** - 无法打开文件。