Document feedback

Question document fragment

When a question document fragment contains a formula, it is displayed as a space.

Submission type
issue

It's a little complicated...

I'd like to ask someone.

Please select the submission type

Problem type
Specifications and Common Mistakes

- Specifications and Common Mistakes:

- Misspellings or punctuation mistakes,incorrect formulas, abnormal display.

- Incorrect links, empty cells, or wrong formats.

- Chinese characters in English context.

- Minor inconsistencies between the UI and descriptions.

- Low writing fluency that does not affect understanding.

- Incorrect version numbers, including software package names and version numbers on the UI.

Usability

- Usability:

- Incorrect or missing key steps.

- Missing main function descriptions, keyword explanation, necessary prerequisites, or precautions.

- Ambiguous descriptions, unclear reference, or contradictory context.

- Unclear logic, such as missing classifications, items, and steps.

Correctness

- Correctness:

- Technical principles, function descriptions, supported platforms, parameter types, or exceptions inconsistent with that of software implementation.

- Incorrect schematic or architecture diagrams.

- Incorrect commands or command parameters.

- Incorrect code.

- Commands inconsistent with the functions.

- Wrong screenshots.

- Sample code running error, or running results inconsistent with the expectation.

Risk Warnings

- Risk Warnings:

- Lack of risk warnings for operations that may damage the system or important data.

Content Compliance

- Content Compliance:

- Contents that may violate applicable laws and regulations or geo-cultural context-sensitive words and expressions.

- Copyright infringement.

Please select the type of question

Problem description

Describe the bug so that we can quickly locate the problem.

mindspore.ops.std

mindspore.ops.std(input_x, axis=(), unbiased=True, keep_dims=False)[source]

Returns the standard-deviation and mean of each row of the input tensor by default, or it can calculate them in specified dimension axis. If axis is a list of dimensions, reduce over all of them.

Parameters
  • input_x (Tensor[Number]) – Input tensor with a dtype of number.Number, its shape should be (N,) where means any number of additional dims, its rank should be less than 8.

  • axis (Union[int, tuple(int), list(int)]) – The dimensions to reduce. Default: (), reduce all dimensions. Only constant value is allowed. Must be in the range [-rank(input_x), rank(input_x)).

  • unbiased (bool) – Whether to use Bessel’s correction. If true, will use the Bessel correction unbiased estimation. If false, will through the biased estimation to calculate the standard deviation.

  • keep_dims (bool) – Whether the output tensor has dim retained or not. If true, keep these reduced dimensions and the length is 1. If false, don’t keep these dimensions.

Returns

A tuple of 2 Tensors (output_std, output_mean) containing the standard deviation and mean. Suppose the shape of input_x is (x0,x1,...,xR):

  • If axis is () and keep_dims is set to False, returns a 0-D Tensor, indicating the standard deviation of all elements in input_x.

  • If axis is int 1 and keep_dims is set to False, then the returned Tensor has shape (x0,x2,...,xR).

  • If axis is tuple(int) or list(int), e.g. (1, 2) and keep_dims is set to False, then the returned Tensor has shape (x0,x2,...,xR).

Raises
  • TypeError – If input_x is not a Tensor.

  • TypeError – If axis is not one of the following: int, tuple or list.

  • TypeError – If keep_dims is not a bool.

  • ValueError – If axis is out of range.

Supported Platforms:

Ascend CPU

Examples

>>> input_x = Tensor(np.array([[1, 2, 3], [-1, 1, 4]]).astype(np.float32))
>>> output = ops.std(input_x, 1, True, False)
>>> output_std, output_mean = output[0], output[1]
>>> print(output_std)
[1.        2.5166116]
>>> print(output_mean)
[2.        1.3333334]