提交 0163c110 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!416 Fix apply ops comments

Merge pull request !416 from xiefangqi/br_fix_apply_comment
...@@ -516,22 +516,14 @@ class Dataset: ...@@ -516,22 +516,14 @@ class Dataset:
Dataset, applied by the function. Dataset, applied by the function.
Examples: Examples:
>>> import numpy as np
>>> import mindspore.dataset as ds >>> import mindspore.dataset as ds
>>> # Generate 1d int numpy array from 0 - 6 >>> # data is an instance of Dataset object
>>> def generator_1d(): >>> # declare an apply_func function which returns a Dataset object
>>> 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
>>> def apply_func(ds): >>> def apply_func(ds):
>>> ds = ds.batch(2) >>> ds = ds.batch(2)
>>> return ds >>> return ds
>>> # 3) use apply to call apply_func >>> # use apply to call apply_func
>>> data = data.apply(apply_func) >>> data = data.apply(apply_func)
>>> for item in data.create_dict_iterator():
>>> print(item["data"])
Raises: Raises:
TypeError: If apply_func is not a function. TypeError: If apply_func is not a function.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册