Metadata-Version: 2.4
Name: antsnormflows
Version: 1.0.0
Summary: PyTorch implementation of normalizing flows (Glow 2D/3D, coupling layers, utilities)
Author: ntustison
License-Expression: Apache-2.0 AND MIT
Project-URL: Homepage, https://github.com/ANTsX/ANTsNormalizingFlows
Project-URL: Repository, https://github.com/ANTsX/ANTsNormalizingFlows
Project-URL: Issues, https://github.com/ANTsX/ANTsNormalizingFlows/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Development Status :: 3 - Alpha
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: torch
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: pytest-cov>=4.1; extra == "test"
Requires-Dist: hypothesis>=6.0; extra == "test"
Requires-Dist: matplotlib; extra == "test"
Provides-Extra: dev
Requires-Dist: black>=24.0; extra == "dev"
Requires-Dist: ruff>=0.6.0; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: pre-commit>=3.6; extra == "dev"
Requires-Dist: build>=1.2.1; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: sphinx>=7.2; extra == "docs"
Requires-Dist: sphinx-design>=0.6; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
Provides-Extra: examples
Requires-Dist: matplotlib; extra == "examples"
Requires-Dist: jupyterlab; extra == "examples"
Requires-Dist: tqdm; extra == "examples"
Requires-Dist: scikit-learn; extra == "examples"
Requires-Dist: ipywidgets; extra == "examples"
Requires-Dist: pandas; extra == "examples"
Requires-Dist: torchvision; extra == "examples"
Dynamic: license-file

# ANTsNormalizingFlows

[![Test coverage](https://raw.githubusercontent.com/ANTsX/ANTsNormalizingFlows/coverage-badge/coverage.svg)](https://github.com/ANTsX/ANTsNormalizingFlows/actions/workflows/pytest.yaml)

An updated PyTorch package (from
[normflows](https://github.com/VincentStimper/normalizing-flows)) for discrete normalizing
flows.

<!--
## Installation

Requires Python ≥ 3.10 and a working PyTorch installation (GPU optional).

```bash
pip install -e .
```

To run example notebooks:

```bash
pip install -e .[examples]
```

-->

## Quick start

```python
import antsnormflows as nf

# Base distribution (2D diagonal Gaussian)
base = nf.distributions.base.DiagGaussian(2)

# Real NVP with simple MLP conditioner
flows = []
num_layers = 8
for _ in range(num_layers):
    param_map = nf.nets.MLP([1, 64, 64, 2], init_zeros=True)
    flows.append(nf.flows.AffineCouplingBlock(param_map))
    flows.append(nf.flows.Permute(2, mode="swap"))

model = nf.NormalizingFlow(base, flows)
loss = model.forward_kld(x)  # x: (batch, 2)
loss.backward()
```

## Documentation

* [Original documentation](https://vincentstimper.github.io/normalizing-flows/)

## Citation

If you use `antsnormflows`, please cite the corresponding papers:

* Stimper et al. (2023). *normflows: A PyTorch Package for Normalizing Flows*.
  Journal of Open Source Software, 8(86), 5361,
  [JOSS](https://doi.org/10.21105/joss.05361).

    <details>
    <summary>BibTeX</summary>

    ```bibtex
    @article{Stimper2023,
      author = {Stimper, Vincent and Liu, David and Campbell, Andrew and Berenz, Vincent and Ryll, Lukas and Schölkopf, Bernhard and Hernández-Lobato, José Miguel},
      title = {normflows: A PyTorch Package for Normalizing Flows},
      journal = {Journal of Open Source Software},
      volume = {8},
      number = {86},
      pages = {5361},
      publisher = {The Open Journal},
      doi = {10.21105/joss.05361},
      url = {https://doi.org/10.21105/joss.05361},
      year = {2023}
    }
    ```

    </details>

* Tustison et al. (2026). *Deep Computational Anatomy via Latent-Aligned Multiview
  Normalizing Flows*. [bioRxiv](https://www.biorxiv.org/content/10.64898/2026.05.05.723039v1).

  <details>
  <summary>BibTeX</summary>

  ```bibtex
  @article{Tustison2026.05.05.723039,
    author = {Tustison, Nicholas James and Avants, Brian B. and Cook, Philip A. and Gee, James C. and Stone, James R.},
    title = {Deep Computational Anatomy via Latent-Aligned Multiview Normalizing Flows},
    elocation-id = {2026.05.05.723039},
    year = {2026},
    doi = {10.64898/2026.05.05.723039},
    publisher = {Cold Spring Harbor Laboratory},
    url = {https://www.biorxiv.org/content/early/2026/05/10/2026.05.05.723039},
    eprint = {https://www.biorxiv.org/content/early/2026/05/10/2026.05.05.723039.full.pdf},
    journal = {bioRxiv}
  }
  ```
  </details>

