# nanmean¶

paddle. nanmean ( x, axis=None, keepdim=False, name=None ) [source]

Compute the arithmetic mean along the specified axis, ignoring NaNs.

Parameters
• x (Tensor) – The input Tensor with data type uint16, float16, float32, float64.

• axis (int|list|tuple, optional) – The axis along which to perform nanmean calculations. `axis` should be int, list(int) or tuple(int). If `axis` is a list/tuple of dimension(s), nanmean is calculated along all element(s) of `axis` . `axis` or element(s) of `axis` should be in range [-D, D), where D is the dimensions of `x` . If `axis` or element(s) of `axis` is less than 0, it works the same way as \(axis + D\) . If `axis` is None, nanmean is calculated over all elements of `x`. Default is None.

• keepdim (bool, optional) – Whether to reserve the reduced dimension(s) in the output Tensor. If `keepdim` is True, the dimensions of the output Tensor is the same as `x` except in the reduced dimensions(it is of size 1 in this case). Otherwise, the shape of the output Tensor is squeezed in `axis` . Default is False.

• name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

Tensor, results of arithmetic mean along `axis` of `x`, with the same data type as `x`.

Examples

```import paddle
# x is a 2-D Tensor:
x = paddle.to_tensor([[float('nan'), 0.3, 0.5, 0.9],
[0.1, 0.2, float('-nan'), 0.7]])
# 0.44999996
# [0.1, 0.25, 0.5, 0.79999995]
# [[0.1, 0.25, 0.5, 0.79999995]]