nangeomean

nangeomean(data: Tensor, dim: tuple[int, ...] | int | None = None, keepdim: bool = False, **kwargs) Tensor[source]

Returns a tensor with dimensions reduced by taking the geometric mean, excluding NaN values.

The geometric mean is calculated by taking the arithmetic mean of the log, where zero and NaN values are ignored. If all elements being reduced are zero or NaN, then the output is zero.

Parameters:
  • data (torch.Tensor) – tensor to which operations should be applied.

  • dim (tuple[int, ...] | int | None, optional) – dimension(s) along which the reduction should be applied, all dimensions when None. Defaults to None.

  • keepdim (bool, optional) – if the dimensions should be retained in the output. Defaults to False.

Returns:

dimensionally reduced tensor.

Return type:

torch.Tensor