mindspore.ops.nanmedian
- mindspore.ops.nanmedian(input, axis=- 1, keepdims=False)[source]
Computes the median and indices of input in specified dimension, ignoring NaN.
Warning
indices does not necessarily contain the first occurrence of each median value found in the input, unless it is unique.
- Parameters
- Returns
Tuple(median, median_indices)
- Supported Platforms:
CPU
Examples
>>> import mindspore >>> x = mindspore.tensor([[0.57, 0.11, float("nan")], ... [0.38, float("nan"), float("nan")], ... [0.36, 0.16, float("nan")]], mindspore.float32) >>> y, idx = mindspore.ops.nanmedian(x, axis=0, keepdims=False) >>> print(y) [0.38 0.11 nan] >>> print(idx) [1 0 0]