diff --git a/mindspore/nn/layer/lstm.py b/mindspore/nn/layer/lstm.py index d17e7689401..f394686e5a8 100755 --- a/mindspore/nn/layer/lstm.py +++ b/mindspore/nn/layer/lstm.py @@ -339,7 +339,7 @@ class LSTMCell(Cell): mindspore.float16 and shape (num_directions, batch_size, `hidden_size`). - **c** - data type mindspore.float32 or mindspore.float16 and shape (num_directions, batch_size, `hidden_size`). - The data type of `h' and 'c' must be the same of `x`. + The data type of `h` and `c` must be the same of `x`. - **w** - data type mindspore.float32 or mindspore.float16 and shape (`weight_size`, 1, 1). The value of `weight_size` depends on `input_size`, `hidden_size` and `bidirectional` diff --git a/mindspore/nn/layer/normalization.py b/mindspore/nn/layer/normalization.py index b816e3678be..d8e23508c54 100644 --- a/mindspore/nn/layer/normalization.py +++ b/mindspore/nn/layer/normalization.py @@ -393,9 +393,11 @@ class BatchNorm2d(_BatchNorm): The implementation of BatchNorm is different in graph mode and pynative mode, therefore that mode can not be changed after net was initialized. Note that the formula for updating the moving_mean and moving_var is + .. math:: \text{moving_mean}=\text{moving_mean∗momentum}+μ_β\text{∗(1−momentum)}\\ \text{moving_var}=\text{moving_var∗momentum}+σ^2_β\text{∗(1−momentum)} + where :math:`moving_mean, moving_var` are the updated mean and variance, :math:`μ_β, σ^2_β` are the observed value (mean and variance) of each batch of data. diff --git a/mindspore/nn/loss/loss.py b/mindspore/nn/loss/loss.py index a518f559a2d..9ee33251892 100644 --- a/mindspore/nn/loss/loss.py +++ b/mindspore/nn/loss/loss.py @@ -260,8 +260,8 @@ class MSELoss(LossBase): .. math:: \ell(x, y) = \begin{cases} - \operatorname{mean}(L), & \text{if reduction} = \text{`mean';}\\ - \operatorname{sum}(L), & \text{if reduction} = \text{`sum'.} + \operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\ + \operatorname{sum}(L), & \text{if reduction} = \text{'sum'.} \end{cases} Args: diff --git a/mindspore/nn/optim/thor.py b/mindspore/nn/optim/thor.py index 265d168cf0e..da40ecb0d51 100644 --- a/mindspore/nn/optim/thor.py +++ b/mindspore/nn/optim/thor.py @@ -320,7 +320,7 @@ def thor(net, learning_rate, damping, momentum, weight_decay=0.0, loss_scale=1.0 Raises: TypeError: If `learning_rate` is not Tensor. - TypeError: If `loss_scale`,`momentum` or `frequency` is not a float. + TypeError: If `loss_scale`, `momentum` or `frequency` is not a float. TypeError: If `weight_decay` is neither float nor int. TypeError: If `use_nesterov` is not a bool. ValueError: If `loss_scale` is less than or equal to 0. diff --git a/mindspore/nn/sparse/sparse.py b/mindspore/nn/sparse/sparse.py index cb3ebc31907..bb3f55ce64e 100644 --- a/mindspore/nn/sparse/sparse.py +++ b/mindspore/nn/sparse/sparse.py @@ -97,7 +97,7 @@ class SparseTensorDenseMatmul(Cell): Raises: TypeError: If the type of `adjoint_st` or `adjoint_dt` is not bool, or the dtype of `indices`, dtype of `values` and dtype of `dense` don't meet the parameter description. - ValueError: If `sparse_shape`, shape of `indices, shape of `values`, + ValueError: If `sparse_shape`, shape of `indices`, shape of `values`, and shape of `dense` don't meet the parameter description. Supported Platforms: diff --git a/mindspore/ops/operations/array_ops.py b/mindspore/ops/operations/array_ops.py index a88142888b1..506b87bd853 100755 --- a/mindspore/ops/operations/array_ops.py +++ b/mindspore/ops/operations/array_ops.py @@ -139,7 +139,7 @@ def _check_infer_attr_reduce(axis, keep_dims, prim_name): class ExpandDims(PrimitiveWithInfer): """ - Adds an additional dimension to 'input_x` at the given axis. + Adds an additional dimension to `input_x` at the given axis. Note: If the specified axis is a negative number, the index is counted @@ -783,7 +783,7 @@ class Unique(Primitive): The shape is :math:`(N,*)` where :math:`*` means, any number of additional dimensions. Outputs: - Tuple, containing Tensor objects `(y, idx), `y` is a tensor with the + Tuple, containing Tensor objects (`y`, `idx`), `y` is a tensor with the same type as `input_x`, and contains the unique elements in `x`, sorted in ascending order. `idx` is a tensor containing indices of elements in the input corresponding to the output tensor. @@ -999,7 +999,7 @@ class UniqueWithPad(PrimitiveWithInfer): Returns unique elements and relative indexes in 1-D tensor, filled with padding num. The basic function is the same as the Unique operator, but the UniqueWithPad operator adds a Pad function. - The returned tuple(`y`,`idx`) after the input Tensor `x` is processed by the unique operator, + The returned tuple(`y`, `idx`) after the input Tensor `x` is processed by the unique operator, in which the shapes of `y` and `idx` are mostly not equal. Therefore, in order to solve the above situation, the UniqueWithPad operator will fill the `y` Tensor with the `pad_num` specified by the user to make it have the same shape as the Tensor `idx`. diff --git a/mindspore/ops/operations/nn_ops.py b/mindspore/ops/operations/nn_ops.py index 6a597f865ef..bae9294e7c4 100755 --- a/mindspore/ops/operations/nn_ops.py +++ b/mindspore/ops/operations/nn_ops.py @@ -7668,9 +7668,9 @@ class DynamicRNN(PrimitiveWithInfer): Inputs: - **x** (Tensor) - Current words. Tensor of shape :math:`(num\_step, batch\_size, input\_size)`. The data type must be float16. - - **w** (Tensor) - Weight. Tensor of shape :math:`(input\_size + hidden\_size, 4 x hidden\_size)`. + - **w** (Tensor) - Weight. Tensor of shape :math:`(input\_size + hidden\_size, 4 * hidden\_size)`. The data type must be float16. - - **b** (Tensor) - Bias. Tensor of shape :math`(4 x hidden\_size)`. + - **b** (Tensor) - Bias. Tensor of shape :math:`(4 * hidden\_size)`. The data type must be float16 or float32. - **seq_length** (Tensor) - The length of each batch. Tensor of shape :math:`(batch\_size, )`. Only `None` is currently supported. @@ -8042,7 +8042,7 @@ class LRN(PrimitiveWithInfer): where the :math:`a_{c}` indicates the represents the specific value of the pixel corresponding to c in feature map; where the :math:`n/2` indicate the `depth_radius`; where the :math:`k` indicate the `bias`; - where the :math:`\alpha` indicate the`alpha`; where the :math:`\beta` indicate the `beta`. + where the :math:`\alpha` indicate the `alpha`; where the :math:`\beta` indicate the `beta`. Args: depth_radius (int): Half-width of the 1-D normalization window with the shape of 0-D. Default: 5. diff --git a/mindspore/ops/operations/sparse_ops.py b/mindspore/ops/operations/sparse_ops.py index b2e14a7d3c5..756402ab07d 100644 --- a/mindspore/ops/operations/sparse_ops.py +++ b/mindspore/ops/operations/sparse_ops.py @@ -40,7 +40,7 @@ class SparseToDense(PrimitiveWithInfer): Raises: TypeError: If the dtype of `indices` is neither int32 nor int64. - ValueError: If `sparse_shape`, shape of `indices and shape of `values` don't meet the parameter description. + ValueError: If `sparse_shape`, shape of `indices` and shape of `values` don't meet the parameter description. Supported Platforms: ``CPU`` @@ -119,7 +119,7 @@ class SparseTensorDenseMatmul(PrimitiveWithInfer): Raises: TypeError: If the type of `adjoint_st` or `adjoint_dt` is not bool, or the dtype of `indices`, dtype of `values` and dtype of `dense` don't meet the parameter description. - ValueError: If `sparse_shape`, shape of `indices, shape of `values`, + ValueError: If `sparse_shape`, shape of `indices`, shape of `values`, and shape of `dense` don't meet the parameter description. Supported Platforms: