From 2730f95d20b186658a4536c7bf83c8b705d27a31 Mon Sep 17 00:00:00 2001 From: zhangyi Date: Wed, 17 Mar 2021 16:05:05 +0800 Subject: [PATCH] fix some error api comments. --- mindspore/dataset/engine/datasets.py | 10 ++++------ mindspore/nn/cell.py | 4 ++-- mindspore/nn/layer/normalization.py | 2 +- mindspore/numpy/math_ops.py | 8 ++++---- mindspore/ops/operations/array_ops.py | 20 ++++++++++---------- mindspore/ops/operations/nn_ops.py | 2 +- mindspore/ops/primitive.py | 2 +- 7 files changed, 23 insertions(+), 25 deletions(-) diff --git a/mindspore/dataset/engine/datasets.py b/mindspore/dataset/engine/datasets.py index e4253dc7a0..162a4e29cc 100644 --- a/mindspore/dataset/engine/datasets.py +++ b/mindspore/dataset/engine/datasets.py @@ -1751,12 +1751,10 @@ class MappableDataset(SourceDataset): original dataset. If after rounding: - - Any size equals 0, an error will occur. - - - The sum of split sizes < K, the difference will be added to the first split. - - - The sum of split sizes > K, the difference will be removed from the first large - enough split such that it will have at least 1 row after removing the difference. + - Any size equals 0, an error will occur. + - The sum of split sizes < K, the difference will be added to the first split. + - The sum of split sizes > K, the difference will be removed from the first large + enough split such that it will have at least 1 row after removing the difference. randomize (bool, optional): Determines whether or not to split the data randomly (default=True). If True, the data will be randomly split. Otherwise, each split will be created with diff --git a/mindspore/nn/cell.py b/mindspore/nn/cell.py index f2f72bc187..b409d98828 100755 --- a/mindspore/nn/cell.py +++ b/mindspore/nn/cell.py @@ -1163,9 +1163,9 @@ class Cell(Cell_): Note: - If the computation involves something like randomization or global variable, the equivalence - is not guaranteed currently. + is not guaranteed currently. - If the recompute api of a primitive in this cell is also called, the recompute mode of this - primitive is subject to the recompute api of the primitive. + primitive is subject to the recompute api of the primitive. Args: mode (bool): Specifies whether the cell is recomputed. Default: True. diff --git a/mindspore/nn/layer/normalization.py b/mindspore/nn/layer/normalization.py index 47bc6cd90a..a641f1df83 100644 --- a/mindspore/nn/layer/normalization.py +++ b/mindspore/nn/layer/normalization.py @@ -915,7 +915,7 @@ class InstanceNorm2d(Cell): Supported Platforms: ``GPU`` - Raise: + Raises: TypeError: If `num_features` is not an int. TypeError: If `eps` is not a float. TypeError: If `momentum` is not a float. diff --git a/mindspore/numpy/math_ops.py b/mindspore/numpy/math_ops.py index 0d7a7f61b6..8cc86fab07 100644 --- a/mindspore/numpy/math_ops.py +++ b/mindspore/numpy/math_ops.py @@ -535,7 +535,7 @@ def minimum(x1, x2, dtype=None): Compares two tensors and returns a new tensor containing the element-wise minima. - Note: + Note: Numpy arguments `out`, `where`, `casting`, `order`, `subok`, `signature`, and `extobj` are not supported. Unlike numpy, when one of the elements is a NaN, the second element is @@ -818,11 +818,11 @@ def tensordot(a, b, axes=2): `a` and the first `N` dimensions of `b` are summed over. Three common use cases are: - ``axes = 0`` : tensor product + - ``axes = 0`` : tensor product - ``axes = 1`` : tensor dot product + - ``axes = 1`` : tensor dot product - ``axes = 2`` : (default) tensor double contraction + - ``axes = 2`` : (default) tensor double contraction When axes is integer_like, the sequence for evaluation will be: first the `-Nth` axis in `a` and 0th axis in `b`, and the -1th axis in `a` and `Nth` axis in `b` last. diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index b8bb8f0ade..5d225b116d 100644 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -2891,16 +2891,16 @@ class StridedSlice(PrimitiveWithInfer): Tensor. The output is explained by following example. - - In the 0th dimension, begin is 1, end is 2, and strides is 1, - because :math:`1+1=2\geq2`, the interval is :math:`[1,2)`. - Thus, return the element with :math:`index = 1` in 0th dimension, i.e., [[3, 3, 3], [4, 4, 4]]. - - In the 1st dimension, similarly, the interval is :math:`[0,1)`. - Based on the return value of the 0th dimension, return the element with :math:`index = 0`, - i.e., [3, 3, 3]. - - In the 2nd dimension, similarly, the interval is :math:`[0,3)`. - Based on the return value of the 1st dimension, return the element with :math:`index = 0,1,2`, - i.e., [3, 3, 3]. - - Finally, the output is [3, 3, 3]. + - In the 0th dimension, begin is 1, end is 2, and strides is 1, + because :math:`1+1=2\geq2`, the interval is :math:`[1,2)`. + Thus, return the element with :math:`index = 1` in 0th dimension, i.e., [[3, 3, 3], [4, 4, 4]]. + - In the 1st dimension, similarly, the interval is :math:`[0,1)`. + Based on the return value of the 0th dimension, return the element with :math:`index = 0`, + i.e., [3, 3, 3]. + - In the 2nd dimension, similarly, the interval is :math:`[0,3)`. + Based on the return value of the 1st dimension, return the element with :math:`index = 0,1,2`, + i.e., [3, 3, 3]. + - Finally, the output is [3, 3, 3]. Raises: TypeError: If `begin_mask`, `end_mask`, `ellipsis_mask`, `new_axis_mask` or `shrink_axis_mask` is not an int. diff --git a/mindspore/ops/operations/nn_ops.py b/mindspore/ops/operations/nn_ops.py index caf1301bf8..0e69df5a8c 100644 --- a/mindspore/ops/operations/nn_ops.py +++ b/mindspore/ops/operations/nn_ops.py @@ -521,7 +521,7 @@ class ReLUV2(PrimitiveWithInfer): Raises: TypeError: If `input_x`, `output` or `mask` is not a Tensor. - TypeError: If dtype of `output` is not same as `input_x`. + TypeError: If dtype of `output` is not same as `input_x` . TypeError: If dtype of `mask` is not unit8. Supported Platforms: diff --git a/mindspore/ops/primitive.py b/mindspore/ops/primitive.py index 8fe67dc10b..3f4571b513 100644 --- a/mindspore/ops/primitive.py +++ b/mindspore/ops/primitive.py @@ -228,7 +228,7 @@ class Primitive(Primitive_): Note: - If the computation involves something like randomization or global variable, the equivalence - is not guaranteed currently. + is not guaranteed currently. Args: mode (bool): Specifies whether the primitive is recomputed. Default: True.