torch.igamma(input, other, *, out=None) → Tensor

Computes the regularized lower incomplete gamma function:

outi=1Γ(inputi)0otheritinputi1etdt\text{out}_{i} = \frac{1}{\Gamma(\text{input}_i)} \int_0^{\text{other}_i} t^{\text{input}_i-1} e^{-t} dt

where both inputi\text{input}_i and otheri\text{other}_i are weakly positive and at least one is strictly positive. If both are zero or either is negative then outi=nan\text{out}_i=\text{nan} . Γ()\Gamma(\cdot) in the equation above is the gamma function,

Γ(inputi)=0t(inputi1)etdt.\Gamma(\text{input}_i) = \int_0^\infty t^{(\text{input}_i-1)} e^{-t} dt.

See torch.igammac() and torch.lgamma() for related functions.

Supports broadcasting to a common shape and float inputs.


The backward pass with respect to input is not yet supported. Please open an issue on PyTorch’s Github to request it.

  • input (Tensor) – the first non-negative input tensor

  • other (Tensor) – the second non-negative input tensor

Keyword Arguments

out (Tensor, optional) – the output tensor.


>>> a1 = torch.tensor([4.0])
>>> a2 = torch.tensor([3.0, 4.0, 5.0])
>>> a = torch.igammac(a1, a2)
tensor([0.3528, 0.5665, 0.7350])
tensor([0.3528, 0.5665, 0.7350])
>>> b = torch.igamma(a1, a2) + torch.igammac(a1, a2)
tensor([1., 1., 1.])


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources