mindspore2022/docs/api/api_python/mindspore/mindspore.DatasetHelper.rst

47 lines
1.6 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.DatasetHelper
========================
.. py:class:: mindspore.DatasetHelper(dataset, dataset_sink_mode=True, sink_size=-1, epoch_num=1)
DatasetHelper是一个处理MindData数据集的类提供数据集信息。
根据不同的上下文,改变数据集的迭代,在不同的上下文中使用相同的迭代。
.. note::
DatasetHelper的迭代将提供一个epoch的数据。
**参数:**
- **dataset** (Dataset) - 训练数据集迭代器。数据集可以由数据集生成器API在 :class:`mindspore.dataset` 中生成,例如 :class:`mindspore.dataset.ImageFolderDataset`
- **dataset_sink_mode** (bool) - 如果值为True使用 :class:`mindspore.ops.GetNext` 在设备Device上通过数据通道中获取数据否则在主机Host直接遍历数据集获取数据。默认值True。
- **sink_size** (int) - 控制每个下沉中的数据量。如果 `sink_size` 为-1则下沉每个epoch的完整数据集。如果 `sink_size` 大于0则下沉每个epoch的 `sink_size` 数据。默认值:-1。
- **epoch_num** (int) - 控制待发送的epoch数据量。默认值1。
.. py:method:: continue_send()
在epoch开始时继续向设备发送数据。
.. py:method:: dynamic_min_max_shapes()
返回动态数据的形状(shape)范围(最小形状(shape),最大形状(shape))。
.. py:method:: get_data_info()
下沉模式下,获取当前批次数据的类型和形状(shape)。通常在数据形状(shape)动态变化的场景使用。
.. py:method:: release()
释放数据下沉资源。
.. py:method:: sink_size()
获取每次迭代的 `sink_size`
.. py:method:: stop_send()
停止发送数据下沉数据。
.. py:method:: types_shapes()
从当前配置中的数据集获取类型和形状(shape)。