mindspore/docs/api/api_python/ops/mindspore.ops.func_median.rst

23 lines
1.2 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.median
====================
.. py:function:: mindspore.ops.median(x, axis=-1, keepdims=False)
输出Tensor指定维度上的中值与索引。
参数:
- **x** (Tensor) - median的输入任意维度的Tensor。数据类型支持int16、int32、int64、float32或float64。
- **axis** (int可选) - 指定计算维度。默认值:-1。取值范围为[-dims, dims - 1]`dims` 表示 `x` 的维度长度。
- **keepdims** (bool可选) - 表示是否减少维度如果为True输出将与输入保持相同的维度如果为False输出将减少维度。默认值False。
返回:
- **y** (Tensor) - 返回指定维度上的中值,数据类型与 `x` 相同。
- **indices** (bool) - 指定中值索引。数据类型为int64。
异常:
- **TypeError** - `x` 的数据类型不是: int16、int32、int64、float32、float64。
- **TypeError** - `x` 不是Tensor。
- **TypeError** - `axis` 不是int。
- **TypeError** - `keepdims` 不是bool。
- **ValueError** - `axis` 的范围不在[-dims, dims - 1]`dims` 表示 `x` 的维度长度。