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.aminmax

mindspore.ops.aminmax(input, *, axis=0, keepdims=False)[source]

It returns the minimum and maximum value along the given axis of input tensor.

Parameters

input (Tensor) – The input tensor, can be any dimension. Set the shape of input tensor as (x1,x2,...,xN) .

Keyword Arguments
  • axis (int, optional) – The dimension to reduce. The value range of axis is [-rank, rank), where "rank" is the dimension of input. If axis is None, computes the minimum and maximum value along the entire input tensor. Default: 0 .

  • keepdims (bool, optional) – Whether to maintain dimension. When set to True, the output will keep the same dimension as the input, or the dimension specified by axis is reduced. Default: False .

Returns

tuple (Tensor), containing the minimum value and maximum value of the input tensor.

  • If keepdims is True, the shape of output tensors is (x1,x2,...,xaxis1,1,xaxis+1,...,xN).

  • If keepdims is False, the shape of output tensors is (x1,x2,...,xaxis1,xaxis+1,...,xN).

Raises
  • TypeError – If keepdims is not a bool.

  • TypeError – If axis is not an int and not None.

  • ValueError – If axis is not in range [-rank, rank).

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([0.0, 0.4, 0.6, 0.7, 0.1]), mindspore.float32)
>>> output0, output1 = ops.aminmax(x)
>>> print(output0, output1)
0.0 0.7
>>> output2, output3 = ops.aminmax(x, axis=-1, keepdims=True)
>>> print(output2, output3)
[0.] [0.7]
>>> x = Tensor(np.array([[0.0, 0.4, 0.6, 0.7, 0.1], [0.78, 0.97, 0.5, 0.82, 0.99]]), mindspore.float32)
>>> output4, output5 = ops.aminmax(x, axis=None, keepdims=True)
>>> print(output4, output5)
[[0.]] [[0.99]]