k-onoue/torch-betainc: torch-betainc: A fully differentiable implementation of the regularized incomplete beta function for PyTorch
Abstract
torch-betainc torch-betainc is a Python library that provides a numerically stable and fully differentiable implementation of the regularized incomplete beta function $I_x(a, b)$ for the PyTorch ecosystem. While standard deep learning libraries often lack support for gradients with respect to function parameters in special functions, this library enables automatic differentiation for all arguments ($a, b, \text{and } x$), facilitating its use in gradient-based optimization and probabilistic modeling. Key Features Full Differentiability: Supports backpropagation through all function arguments using custom PyTorch autograd functions. Student's t-distribution Support: Includes a StudentT distribution class with a fully differentiable Cumulative Distribution Function (CDF), a feature currently absent in the core torch.distributions library. Vectorized Computation: Fully supports batched operations and tensor inputs within the PyTorch framework. Installation pip install torch-betainc Credits Credits This implementation is based on the work written in Julia by Arthur Zwaenepoel and has been refactored and extended for full PyTorch compatibility and vectorization. GitHub: https://github.com/k-onoue/torch-betainc PyPI: https://pypi.org/project/torch-betainc/
Fields of Study & Subjects
Computational Physics and Python Applications
Mathematical functions and polynomials
Mathematical and Computational Methods
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 8 February 2026