nip.utils.maths.logit_or#
- nip.utils.maths.logit_or(logits: Tensor, dim: int | None = None) Tensor [source]#
Compute the logit of the OR of n events given their logits.
The logit OR operation is defined as:
\[\max_d(\ell) + \log(1 + \exp(\min_d(\ell) - \max_d(\ell)))\]where \(\max(\ell)\) is the element-wise maximum of the logits along the specified dimension, and \(\min(\ell)\) is the element-wise minimum of the logits along the specified dimension.
- Parameters:
logits (torch.Tensor) – A tensor of logit values.
dim (int, optional) – The dimension along which to apply the OR operation. If None, the operation is applied to all elements.
- Returns:
torch.Tensor – The logit of the OR of input events along the specified dimension.