forked from mindspore-Ecosystem/mindspore
modify examples err
This commit is contained in:
parent
350a4b5a68
commit
7fc14d1465
|
@ -11,7 +11,7 @@ mindspore.dataset.SogouNewsDataset
|
|||
- **dataset_dir** (str) - 包含数据集文件的根目录路径。
|
||||
- **usage** (str, 可选) - 指定数据集的子集,可取值为 'train', 'test'或 'all'。默认值:None,读取全部样本。
|
||||
取值为 'train'时将会读取45万个训练样本,取值为 'test'时将会读取6万个测试样本,取值为 'all'时将会读取全部51万个样本。默认值:None,读取全部样本。
|
||||
- **num_samples** (int, 可选) - 指定从数据集中读取的样本数。默认值:None, 读取全部样本。
|
||||
- **num_samples** (int, 可选) - 指定从数据集中读取的样本数。默认值:None,读取全部样本。
|
||||
- **shuffle** (Union[bool, Shuffle], 可选) - 每个epoch中数据混洗的模式,支持传入bool类型与枚举类型进行指定。默认值: `Shuffle.GLOBAL` 。
|
||||
如果 `shuffle` 为False,则不混洗,如果 `shuffle` 为True,等同于将 `shuffle` 设置为mindspore.dataset.Shuffle.GLOBAL。
|
||||
通过传入枚举变量设置数据混洗的模式:
|
||||
|
|
|
@ -534,7 +534,8 @@ def positive(x):
|
|||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> from mindspore import Tensor
|
||||
>>> from mindspore import Tensor, ops
|
||||
>>> from mindspore import dtype as mstype
|
||||
>>> x = Tensor(np.array([-5.0, 1.5, 3.0, 100.0]), ms.float32)
|
||||
>>> print(ops.positive(x))
|
||||
[-5.0, 1.5, 3.0, 100.0]
|
||||
|
@ -3272,7 +3273,8 @@ def isreal(x):
|
|||
``GPU`` ``CPU``
|
||||
|
||||
Examples:
|
||||
>>> from mindspore import ops
|
||||
>>> from mindspore import ops, Tensor
|
||||
>>> from mindspore import dtype as mstype
|
||||
>>> x = Tensor([1, 1+1j, 2+0j], mstype.complex64)
|
||||
>>> output = ops.isreal(x)
|
||||
>>> print(output)
|
||||
|
@ -4466,7 +4468,7 @@ def deg2rad(x):
|
|||
|
||||
Examples:
|
||||
>>> x = Tensor(np.array([[90.0, -90.0], [180.0, -180.0], [270.0, -270.0]]).astype(np.float32))
|
||||
>>> output = ops.deg2Rad(x)
|
||||
>>> output = ops.deg2rad(x)
|
||||
>>> print(output)
|
||||
[[ 1.5707964 -1.5707964]
|
||||
[ 3.1415927 -3.1415927]
|
||||
|
|
|
@ -7170,7 +7170,7 @@ class NonZero(Primitive):
|
|||
>>> import mindspore
|
||||
>>> import numpy as np
|
||||
>>> from mindspore import Tensor
|
||||
>>> from mindspore.ops.operations.array_ops import NonZero
|
||||
>>> from mindspore.ops import NonZero
|
||||
>>> x = Tensor(np.array([[[1, 0], [-5, 0]]]), mindspore.int32)
|
||||
>>> nonzero = NonZero()
|
||||
>>> output = nonzero(x)
|
||||
|
|
Loading…
Reference in New Issue