Browse Source

!27379 dataset: add Note for map and GeneratorDataset

Merge pull request !27379 from ms_yan/code_docs_mix_operations
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
b0ce80e3d3
3 changed files with 15 additions and 1 deletions
  1. +4
    -0
      docs/api/api_python/dataset/mindspore.dataset.Dataset.rst
  2. +4
    -1
      docs/api/api_python/dataset/mindspore.dataset.GeneratorDataset.rst
  3. +7
    -0
      mindspore/dataset/engine/datasets.py

+ 4
- 0
docs/api/api_python/dataset/mindspore.dataset.Dataset.rst View File

@@ -447,6 +447,10 @@
- **cache** (DatasetCache, optional) - 使用Tensor缓存服务加快数据集处理速度(默认为None,即不使用缓存)。
- **callbacks** (DSCallback, list[DSCallback], optional) - 要调用的Dataset回调函数列表(默认为None)。
.. note::
- `operations` 参数主要接收 `mindspore.dataset` 模块中c_transforms、py_transforms算子,以及用户定义的Python函数(PyFuncs)。
- 不要将 `mindspore.nn` 和 `mindspore.ops` 或其他的网络计算算子添加到 `operations` 中。
**返回:**
MapDataset,map操作后的数据集。


+ 4
- 1
docs/api/api_python/dataset/mindspore.dataset.GeneratorDataset.rst View File

@@ -37,7 +37,10 @@
- **RuntimeError** - 指定了 `shard_id` 参数,但是未指定 `num_shards` 参数。
- **ValueError** - `shard_id` 参数错误(小于0或者大于等于 `num_shards` )。
.. note:: 此数据集可以指定 `sampler` 参数,但 `sampler` 和 `shuffle` 是互斥的。下表展示了几种合法的输入参数及预期的行为。
.. note::
- `source` 参数接收用户自定义的Python函数(PyFuncs),不要将 `mindspore.nn` 和 `mindspore.ops` 目录下或其他的网络计算算子添加
到 `source` 中。
- 此数据集可以指定 `sampler` 参数,但 `sampler` 和 `shuffle` 是互斥的。下表展示了几种合法的输入参数及预期的行为。
.. list-table:: 配置 `sampler` 和 `shuffle` 的不同组合得到的预期排序结果
:widths: 25 25 50


+ 7
- 0
mindspore/dataset/engine/datasets.py View File

@@ -712,6 +712,11 @@ class Dataset:
data between processes. This is only used if python_multiprocessing is set to True (Default=16).
offload (bool, optional): Flag to indicate whether offload is used (Default=None).

Note:
- Input `operations` mainly accept c_transforms, py_transforms operator in mindspore.dataset part, plus user
defined Python function(PyFuncs).
- Do not add network computing operators from mindspore.nn and mindspore.ops or others into this
`operations`.

Returns:
MapDataset, dataset after mapping operation.
@@ -4832,6 +4837,8 @@ class GeneratorDataset(MappableDataset):
ValueError: If shard_id is invalid (< 0 or >= num_shards).

Note:
- Input `source` accept user defined Python function(PyFuncs), Do not add network computing operators from
mindspore.nn and mindspore.ops or others into this `source`.
- This dataset can take in a `sampler`. `sampler` and `shuffle` are mutually exclusive.
The table below shows what input arguments are allowed and their expected behavior.



Loading…
Cancel
Save