eazygrad.logsumexp

eazygrad.logsumexp(input: _Tensor, dim: int, keepdims: bool = False) _Tensor[source]

Compute log(sum(exp(input))) in a numerically stable way.

Parameters:
  • input (_Tensor) – Input tensor.

  • dim (int) – Axis along which the reduction is performed.

  • keepdims (bool, default=False) – Whether to keep the reduced dimension in the output.

Returns:

_Tensor – Reduced tensor after applying the log-sum-exp operation.

See also

torch.logsumexp