mindspore.mint.median
- mindspore.mint.median(input, dim=None, keepdim=False)[source]
Return the median(s) and indice(s) of the tensor along the specified dimension.
- Parameters
- Returns
Tuple(median, median_indices) of 2 tensors.
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> import mindspore >>> x = mindspore.tensor(np.array([[0.57, 0.11, 0.21],[0.38, 0.50, 0.57], ... [0.36, 0.16, 0.44]]).astype(np.float32)) >>> y = mindspore.mint.median(x, dim=0, keepdim=False) >>> print(y) (Tensor(shape=[3], dtype=Float32, value= [ 3.79999995e-01, 1.59999996e-01, 4.39999998e-01]), Tensor(shape=[3], dtype=Int64, value= [1, 2, 2]))