Browse Source

!416 Fix apply ops comments

Merge pull request !416 from xiefangqi/br_fix_apply_comment
tags/v0.2.0-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
0163c11028
1 changed files with 3 additions and 11 deletions
  1. +3
    -11
      mindspore/dataset/engine/datasets.py

+ 3
- 11
mindspore/dataset/engine/datasets.py View File

@@ -516,22 +516,14 @@ class Dataset:
Dataset, applied by the function.

Examples:
>>> import numpy as np
>>> import mindspore.dataset as ds
>>> # Generate 1d int numpy array from 0 - 6
>>> def generator_1d():
>>> for i in range(6):
>>> yield (np.array([i]),)
>>> # 1) get all data from dataset
>>> data = ds.GeneratorDataset(generator_1d, ["data"])
>>> # 2) declare a apply_func function
>>> # data is an instance of Dataset object
>>> # declare an apply_func function which returns a Dataset object
>>> def apply_func(ds):
>>> ds = ds.batch(2)
>>> return ds
>>> # 3) use apply to call apply_func
>>> # use apply to call apply_func
>>> data = data.apply(apply_func)
>>> for item in data.create_dict_iterator():
>>> print(item["data"])

Raises:
TypeError: If apply_func is not a function.


Loading…
Cancel
Save