optora 0.2.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {optora-0.2.0 → optora-0.4.0}/MANIFEST.in +2 -1
  2. {optora-0.2.0/optora.egg-info → optora-0.4.0}/PKG-INFO +26 -12
  3. {optora-0.2.0 → optora-0.4.0}/README.md +21 -7
  4. {optora-0.2.0 → optora-0.4.0}/optora/__init__.py +4 -2
  5. {optora-0.2.0 → optora-0.4.0}/optora/_version.py +1 -1
  6. {optora-0.2.0 → optora-0.4.0}/optora/core/_transforms.py +1 -1
  7. {optora-0.2.0 → optora-0.4.0}/optora/core/convergence.py +25 -23
  8. {optora-0.2.0 → optora-0.4.0}/optora/core/divergence_base.py +9 -10
  9. {optora-0.2.0 → optora-0.4.0}/optora/core/dro_base.py +149 -108
  10. {optora-0.2.0 → optora-0.4.0}/optora/core/solver_base.py +3 -3
  11. {optora-0.2.0 → optora-0.4.0}/optora/divergences/_entropic.py +26 -24
  12. {optora-0.2.0 → optora-0.4.0}/optora/divergences/entropic_transport.py +38 -36
  13. {optora-0.2.0 → optora-0.4.0}/optora/divergences/f_divergence.py +16 -17
  14. {optora-0.2.0 → optora-0.4.0}/optora/divergences/max_divergence.py +2 -1
  15. {optora-0.2.0 → optora-0.4.0}/optora/divergences/mmd.py +3 -2
  16. {optora-0.2.0 → optora-0.4.0}/optora/divergences/wasserstein.py +57 -43
  17. {optora-0.2.0 → optora-0.4.0}/optora/dro/__init__.py +3 -1
  18. {optora-0.2.0 → optora-0.4.0}/optora/dro/calibration.py +23 -22
  19. {optora-0.2.0 → optora-0.4.0}/optora/dro/group_dro.py +18 -17
  20. {optora-0.2.0 → optora-0.4.0}/optora/dro/kl_dro.py +7 -6
  21. {optora-0.2.0 → optora-0.4.0}/optora/dro/minibatch.py +74 -55
  22. {optora-0.2.0 → optora-0.4.0}/optora/dro/minimax_solver.py +36 -43
  23. {optora-0.2.0 → optora-0.4.0}/optora/dro/mmd_dro.py +157 -72
  24. {optora-0.2.0 → optora-0.4.0}/optora/dro/phi_dro.py +555 -94
  25. {optora-0.2.0 → optora-0.4.0}/optora/dro/sinkhorn_dro.py +16 -14
  26. {optora-0.2.0 → optora-0.4.0}/optora/dro/wasserstein_dro.py +91 -63
  27. {optora-0.2.0 → optora-0.4.0}/optora/solvers/gradient_descent.py +16 -17
  28. {optora-0.2.0 → optora-0.4.0}/optora/solvers/saddle_point.py +13 -14
  29. {optora-0.2.0 → optora-0.4.0/optora.egg-info}/PKG-INFO +26 -12
  30. {optora-0.2.0 → optora-0.4.0}/optora.egg-info/requires.txt +3 -3
  31. {optora-0.2.0 → optora-0.4.0}/pyproject.toml +12 -13
  32. {optora-0.2.0 → optora-0.4.0}/LICENSE +0 -0
  33. {optora-0.2.0 → optora-0.4.0}/optora/core/__init__.py +0 -0
  34. {optora-0.2.0 → optora-0.4.0}/optora/core/precision.py +0 -0
  35. {optora-0.2.0 → optora-0.4.0}/optora/divergences/__init__.py +0 -0
  36. {optora-0.2.0 → optora-0.4.0}/optora/divergences/kl.py +0 -0
  37. {optora-0.2.0 → optora-0.4.0}/optora/solvers/__init__.py +0 -0
  38. {optora-0.2.0 → optora-0.4.0}/optora.egg-info/SOURCES.txt +0 -0
  39. {optora-0.2.0 → optora-0.4.0}/optora.egg-info/dependency_links.txt +0 -0
  40. {optora-0.2.0 → optora-0.4.0}/optora.egg-info/top_level.txt +0 -0
  41. {optora-0.2.0 → optora-0.4.0}/setup.cfg +0 -0
@@ -8,9 +8,10 @@ include LICENSE
8
8
  include README.md
9
9
  include pyproject.toml
10
10
 
11
- # Never ship the documentation/examples ecosystem, progress tracker,
11
+ # Never ship the documentation, tutorials and examples, progress tracker,
12
12
  # built docs site, tests, or release tooling in a source distribution.
13
13
  prune examples
14
+ prune tutorials
14
15
  prune docs
15
16
  prune progress
16
17
  prune site
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optora
3
- Version: 0.2.0
3
+ Version: 0.4.0
4
4
  Summary: A small, composable, PyTorch-native library for distributionally robust optimization.
5
5
  Author: Optora contributors
6
6
  License-Expression: MIT
@@ -24,7 +24,7 @@ License-File: LICENSE
24
24
  Requires-Dist: torch>=2.2
25
25
  Provides-Extra: dev
26
26
  Requires-Dist: build>=1.2; extra == "dev"
27
- Requires-Dist: pytest<9.2,>=8; extra == "dev"
27
+ Requires-Dist: pytest>=8; extra == "dev"
28
28
  Requires-Dist: pytest-cov>=6; extra == "dev"
29
29
  Requires-Dist: ruff>=0.5; extra == "dev"
30
30
  Requires-Dist: mypy>=1.10; extra == "dev"
@@ -33,14 +33,14 @@ Requires-Dist: scipy>=1.11; extra == "dev"
33
33
  Requires-Dist: clarabel>=0.9; extra == "dev"
34
34
  Requires-Dist: hypothesis>=6.100; extra == "dev"
35
35
  Requires-Dist: pyyaml>=6; extra == "dev"
36
- Requires-Dist: pytest-benchmark>=5.1; extra == "dev"
36
+ Requires-Dist: pytest-benchmark>=5.3.1; extra == "dev"
37
37
  Provides-Extra: docs
38
38
  Requires-Dist: zensical>=0.0.11; extra == "docs"
39
39
  Requires-Dist: mkdocstrings-python>=1.10; extra == "docs"
40
40
  Requires-Dist: matplotlib>=3.8; extra == "docs"
41
41
  Requires-Dist: seaborn>=0.13; extra == "docs"
42
- Provides-Extra: examples
43
- Requires-Dist: matplotlib>=3.8; extra == "examples"
42
+ Provides-Extra: tutorials
43
+ Requires-Dist: matplotlib>=3.8; extra == "tutorials"
44
44
  Dynamic: license-file
45
45
 
46
46
  <p align="center">
@@ -55,6 +55,8 @@ Dynamic: license-file
55
55
 
56
56
  Status: alpha &middot; Python 3.10+ &middot; PyTorch &ge;2.2 &middot; MIT License
57
57
 
58
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23850922.svg)](https://doi.org/10.5281/zenodo.23850922)
59
+
58
60
  I started building Optora because most of the DRO code I ran into while
59
61
  reading papers lived inside one-off experiment scripts, hard-wired to
60
62
  whatever setup that particular paper used. Optora is a small, composable
@@ -103,8 +105,9 @@ Ambiguity sets (`optora.dro`), the divergences underneath them
103
105
  are implemented end to end: `KLAmbiguitySet`, `PhiAmbiguitySet` (plus
104
106
  `ChiSquareAmbiguitySet`, `TotalVariationAmbiguitySet`, and
105
107
  `CVaRAmbiguitySet`), `SinkhornAmbiguitySet`, `MMDAmbiguitySet`, and
106
- `WassersteinAmbiguitySet`, wired together by `MinimaxSolver`. Minibatch
107
- training is covered by `MultilevelMonteCarloEstimator`,
108
+ `WassersteinAmbiguitySet`, wired together by `MinimaxSolver`. The penalized
109
+ chi-square objective of Levy et al. (2020) is `PenalizedChiSquareDRO`.
110
+ Minibatch training is covered by `MultilevelMonteCarloEstimator`,
108
111
  `StochasticPhiDual`, and `OnlineGroupDRO` (group DRO, with
109
112
  `optora.dro.group_losses`). Every piece
110
113
  is covered by pytest tests checked against known closed-form results,
@@ -123,9 +126,16 @@ Convergence diagnostics and helper functions live in `optora.core`.
123
126
  [`docs/formulations.md`](docs/formulations.md).
124
127
  - **Training an `nn.Module` against a DRO objective with `torch.optim`:**
125
128
  [`docs/training.md`](docs/training.md).
126
- - **Runnable, visualized DRO examples** (GitHub-only, not shipped with the
127
- package): [`examples/`](examples/README.md) — install with the
128
- `examples` extra (`pip install -e ".[examples]"`).
129
+ - **Runnable, visualized DRO tutorials** (GitHub-only, not shipped with the
130
+ package): [`tutorials/`](tutorials/README.md) — install with the
131
+ `tutorials` extra (`pip install -e ".[tutorials]"`).
132
+ - **Short examples, one component each**, runnable on a plain
133
+ `pip install optora`: [`examples/`](examples/).
134
+ - **Paper reproductions:** published DRO experiments rerun with the
135
+ released package, each claim compared with a tolerance fixed before the
136
+ run, in
137
+ [`optora-reproductions`](https://github.com/navidsharifi/optora-reproductions)
138
+ ([Colab notebook](https://colab.research.google.com/github/navidsharifi/optora-reproductions/blob/main/notebooks/reproductions.ipynb)).
129
139
  - **API reference:** built with Zensical from source docstrings, see
130
140
  [`docs/`](docs/index.md).
131
141
  - **Benchmarks:** latency, scaling, batched throughput, host
@@ -142,7 +152,10 @@ Convergence diagnostics and helper functions live in `optora.core`.
142
152
 
143
153
  ## Citing Optora
144
154
 
145
- If you use Optora in your research, please cite it. The metadata lives in
155
+ If you use Optora in your research, please cite it. Every release is archived
156
+ on Zenodo under the concept DOI
157
+ [10.5281/zenodo.23850922](https://doi.org/10.5281/zenodo.23850922), which
158
+ always resolves to the latest version. The metadata lives in
146
159
  [`CITATION.cff`](CITATION.cff); GitHub's "Cite this repository" button turns
147
160
  it into APA or BibTeX.
148
161
 
@@ -162,7 +175,8 @@ mypy
162
175
  CI runs the tests on Linux, macOS, and Windows against both the minimum and
163
176
  the latest PyTorch, enforces the coverage gate set in `pyproject.toml`, and
164
177
  installs the built wheel into a clean virtual environment to run every
165
- script under `examples/`. Reproduce that smoke test locally with:
178
+ script under `tutorials/` and `examples/`. Reproduce that smoke test locally
179
+ with:
166
180
 
167
181
  ```powershell
168
182
  python -m build
@@ -10,6 +10,8 @@
10
10
 
11
11
  Status: alpha &middot; Python 3.10+ &middot; PyTorch &ge;2.2 &middot; MIT License
12
12
 
13
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23850922.svg)](https://doi.org/10.5281/zenodo.23850922)
14
+
13
15
  I started building Optora because most of the DRO code I ran into while
14
16
  reading papers lived inside one-off experiment scripts, hard-wired to
15
17
  whatever setup that particular paper used. Optora is a small, composable
@@ -58,8 +60,9 @@ Ambiguity sets (`optora.dro`), the divergences underneath them
58
60
  are implemented end to end: `KLAmbiguitySet`, `PhiAmbiguitySet` (plus
59
61
  `ChiSquareAmbiguitySet`, `TotalVariationAmbiguitySet`, and
60
62
  `CVaRAmbiguitySet`), `SinkhornAmbiguitySet`, `MMDAmbiguitySet`, and
61
- `WassersteinAmbiguitySet`, wired together by `MinimaxSolver`. Minibatch
62
- training is covered by `MultilevelMonteCarloEstimator`,
63
+ `WassersteinAmbiguitySet`, wired together by `MinimaxSolver`. The penalized
64
+ chi-square objective of Levy et al. (2020) is `PenalizedChiSquareDRO`.
65
+ Minibatch training is covered by `MultilevelMonteCarloEstimator`,
63
66
  `StochasticPhiDual`, and `OnlineGroupDRO` (group DRO, with
64
67
  `optora.dro.group_losses`). Every piece
65
68
  is covered by pytest tests checked against known closed-form results,
@@ -78,9 +81,16 @@ Convergence diagnostics and helper functions live in `optora.core`.
78
81
  [`docs/formulations.md`](docs/formulations.md).
79
82
  - **Training an `nn.Module` against a DRO objective with `torch.optim`:**
80
83
  [`docs/training.md`](docs/training.md).
81
- - **Runnable, visualized DRO examples** (GitHub-only, not shipped with the
82
- package): [`examples/`](examples/README.md) — install with the
83
- `examples` extra (`pip install -e ".[examples]"`).
84
+ - **Runnable, visualized DRO tutorials** (GitHub-only, not shipped with the
85
+ package): [`tutorials/`](tutorials/README.md) — install with the
86
+ `tutorials` extra (`pip install -e ".[tutorials]"`).
87
+ - **Short examples, one component each**, runnable on a plain
88
+ `pip install optora`: [`examples/`](examples/).
89
+ - **Paper reproductions:** published DRO experiments rerun with the
90
+ released package, each claim compared with a tolerance fixed before the
91
+ run, in
92
+ [`optora-reproductions`](https://github.com/navidsharifi/optora-reproductions)
93
+ ([Colab notebook](https://colab.research.google.com/github/navidsharifi/optora-reproductions/blob/main/notebooks/reproductions.ipynb)).
84
94
  - **API reference:** built with Zensical from source docstrings, see
85
95
  [`docs/`](docs/index.md).
86
96
  - **Benchmarks:** latency, scaling, batched throughput, host
@@ -97,7 +107,10 @@ Convergence diagnostics and helper functions live in `optora.core`.
97
107
 
98
108
  ## Citing Optora
99
109
 
100
- If you use Optora in your research, please cite it. The metadata lives in
110
+ If you use Optora in your research, please cite it. Every release is archived
111
+ on Zenodo under the concept DOI
112
+ [10.5281/zenodo.23850922](https://doi.org/10.5281/zenodo.23850922), which
113
+ always resolves to the latest version. The metadata lives in
101
114
  [`CITATION.cff`](CITATION.cff); GitHub's "Cite this repository" button turns
102
115
  it into APA or BibTeX.
103
116
 
@@ -117,7 +130,8 @@ mypy
117
130
  CI runs the tests on Linux, macOS, and Windows against both the minimum and
118
131
  the latest PyTorch, enforces the coverage gate set in `pyproject.toml`, and
119
132
  installs the built wheel into a clean virtual environment to run every
120
- script under `examples/`. Reproduce that smoke test locally with:
133
+ script under `tutorials/` and `examples/`. Reproduce that smoke test locally
134
+ with:
121
135
 
122
136
  ```powershell
123
137
  python -m build
@@ -4,8 +4,8 @@ The main mathematical nouns are re-exported here so that
4
4
  ``from optora import KLAmbiguitySet, MinimaxSolver`` works. Subpackage imports
5
5
  such as ``from optora.dro import KLAmbiguitySet`` remain equally valid, and the
6
6
  subpackages stay the home of everything not listed in ``__all__`` (convergence
7
- diagnostics, helper functions). No workflow functions live at the root; run an
8
- algorithm with ``Solver.solve(problem)``.
7
+ diagnostics, helper functions). No workflow functions live at the root. An
8
+ algorithm is run with ``Solver.solve(problem)``.
9
9
  """
10
10
 
11
11
  from optora._version import __version__
@@ -38,6 +38,7 @@ from optora.dro import (
38
38
  MMDAmbiguitySet,
39
39
  MultilevelMonteCarloEstimator,
40
40
  OnlineGroupDRO,
41
+ PenalizedChiSquareDRO,
41
42
  PhiAmbiguitySet,
42
43
  SinkhornAmbiguitySet,
43
44
  StochasticPhiDual,
@@ -72,6 +73,7 @@ __all__ = [
72
73
  "MinimizationResult",
73
74
  "MultilevelMonteCarloEstimator",
74
75
  "OnlineGroupDRO",
76
+ "PenalizedChiSquareDRO",
75
77
  "PhiAmbiguitySet",
76
78
  "PhiDivergence",
77
79
  "SaddlePointProblem",
@@ -1,3 +1,3 @@
1
1
  """Package version for Optora."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.4.0"
@@ -1,7 +1,7 @@
1
1
  """Introspection of the active `torch.func` transforms.
2
2
 
3
3
  PyTorch has no public query for whether code runs inside a `torch.func`
4
- transform, which a solver needs to know: `Tensor.requires_grad_` and
4
+ transform. A solver needs to know, because `Tensor.requires_grad_` and
5
5
  `torch.autograd.grad` are unsupported there, and under `vmap` a tensor has
6
6
  no single value to read on the host. This module is the one place optora
7
7
  reads PyTorch's private interpreter stack, so a change to it is a one-line
@@ -14,11 +14,12 @@ class ConvergenceStatus:
14
14
 
15
15
  A loop produces its convergence flag and iteration count on the
16
16
  iterate's device, so reporting them as a Python `bool` and `int` costs
17
- two synchronizations per solve: exactly the cost `ConvergenceTracker`
17
+ two synchronizations per solve. That is the cost `ConvergenceTracker`
18
18
  removes from the loop, paid again once the loop is over. Under nesting
19
- that becomes the dominant cost, since every outer iteration of an
20
- `optora.dro.MinimaxSolver` runs an inner dual solve whose diagnostics
21
- nothing ever reads.
19
+ it becomes the dominant cost, since every outer iteration of an
20
+ `optora.dro.MinimaxSolver` can run an inner solve, such as the dual
21
+ solve of `optora.dro.PhiAmbiguitySet` with a `dual_solver`, whose
22
+ diagnostics nothing reads.
22
23
 
23
24
  `ConvergenceStatus` therefore keeps the diagnostics as the tensors the
24
25
  loop computed and converts them on first access, caching each
@@ -54,7 +55,7 @@ class ConvergenceDiagnostics:
54
55
 
55
56
  Mixed into every solver result so `result.converged` and
56
57
  `result.num_iterations` read as plain Python values while the solve
57
- itself stays asynchronous: `status` holds them as device tensors until
58
+ itself stays asynchronous. `status` holds them as device tensors until
58
59
  one of these properties is read.
59
60
 
60
61
  Attributes:
@@ -80,17 +81,18 @@ class ConvergenceTracker:
80
81
 
81
82
  A textbook iterative method tests `residual < tol` with a Python `if`,
82
83
  which forces a device-to-host copy of the residual on every iteration.
83
- Optora composes such loops (an `optora.dro` ambiguity set's inner dual
84
- solve runs inside a `MinimaxSolver` outer solve, and a Wasserstein
85
- ambiguity set additionally runs Sinkhorn iterations), so a single solve
86
- would issue thousands of accelerator stalls.
84
+ Optora nests such loops. The dual solve of `optora.dro.PhiAmbiguitySet`
85
+ with a `dual_solver`, or the interior-point loop of
86
+ `optora.dro.MMDAmbiguitySet`, runs inside every outer iteration of a
87
+ `MinimaxSolver`, so a single solve would issue thousands of host
88
+ synchronizations.
87
89
 
88
90
  `ConvergenceTracker` keeps the convergence flag and the iteration count
89
91
  as tensors on the iterate's device, updates them with ordinary
90
92
  elementwise kernels, and copies them to the host at most once every
91
93
  `check_interval` iterations. Callers must freeze their iterates with
92
94
  `torch.where(tracker.converged, ...)`, which makes the iterations that
93
- run between two host reads exact no-ops: the returned solution is
95
+ run between two host reads exact no-ops. The returned solution is then
94
96
  identical to one produced by testing convergence every iteration,
95
97
  whatever `check_interval` is. Larger values trade those redundant
96
98
  frozen iterations for fewer synchronizations.
@@ -98,11 +100,11 @@ class ConvergenceTracker:
98
100
  That trade is only favourable when an iteration is cheap relative to a
99
101
  synchronization, which holds for the inner loops this was written for
100
102
  (a few elementwise kernels per iteration against a host read costing
101
- microseconds). Raise `check_interval` only in that regime. Loops whose
102
- single iteration is expensive — notably an outer solve whose objective
103
- is an `optora.dro` worst-case expectation, where one frozen iteration
104
- is an entire inner dual solve — should use `check_interval=1` and pay
105
- the synchronization instead.
103
+ microseconds). Raise `check_interval` only in that regime. A loop whose
104
+ single iteration is expensive should use `check_interval=1` and pay
105
+ the synchronization instead. An example is an outer solve whose
106
+ objective is an `optora.dro` worst-case expectation, where one frozen
107
+ iteration costs an entire inner worst-case solve.
106
108
 
107
109
  Attributes:
108
110
  converged: Zero-dimensional boolean tensor, `True` once the
@@ -122,11 +124,11 @@ class ConvergenceTracker:
122
124
  """Initialize the tracker on the device of `reference`.
123
125
 
124
126
  Args:
125
- tol: Positive tolerance the residual is compared against. Kept
126
- as a Python float: comparing a tensor against a Python
127
- scalar passes it to the comparison kernel directly, whereas
128
- materializing it as a tensor would copy it to the device on
129
- every solve.
127
+ tol: Positive tolerance the residual is compared against. It is
128
+ kept as a Python float, because comparing a tensor against a
129
+ Python scalar passes it to the comparison kernel directly,
130
+ whereas materializing it as a tensor would copy it to the
131
+ device on every solve.
130
132
  check_interval: Number of iterations between host reads of the
131
133
  convergence flag.
132
134
  reference: Iterate whose device the convergence state is held
@@ -146,8 +148,8 @@ class ConvergenceTracker:
146
148
  A loop that evaluates its residual at the current iterate and steps
147
149
  with what it learned there tests the starting iterate once before
148
150
  iterating. That test is not an iteration, so it latches convergence
149
- without advancing the iteration count: a loop that starts at its
150
- own solution reports zero iterations.
151
+ without advancing the iteration count, and a loop that starts at
152
+ its own solution reports zero iterations.
151
153
 
152
154
  Args:
153
155
  residual: Zero-dimensional nonnegative convergence residual at
@@ -188,7 +190,7 @@ class ConvergenceTracker:
188
190
  the frozen iterates make exact for every element.
189
191
 
190
192
  Args:
191
- iteration: Zero-based index of the iteration that just ran.
193
+ iteration: Zero-based index of the most recent iteration.
192
194
 
193
195
  Returns:
194
196
  `True` if this iteration is a checkpoint and the loop has
@@ -16,10 +16,9 @@ class Divergence(nn.Module, ABC):
16
16
 
17
17
  Inherits from `torch.nn.Module` (rather than a plain ABC) so that any
18
18
  divergence holding tensor state (for example `SinkhornDivergence`'s
19
- ground-cost matrix) can register it as a buffer: that state then moves
20
- automatically with `.to(device)`/`.cuda()` and is included in
21
- `state_dict()`, consistent with the rest of `optora` staying GPU-first.
22
- Call an instance directly (`divergence(p, q)`); `nn.Module.__call__`
19
+ ground-cost matrix) can register it as a buffer. That state then moves
20
+ with `.to(device)`/`.cuda()` and is included in `state_dict()`. Call an
21
+ instance directly, as `divergence(p, q)`, and `nn.Module.__call__`
23
22
  dispatches to `forward`.
24
23
  """
25
24
 
@@ -34,12 +33,12 @@ class Divergence(nn.Module, ABC):
34
33
  against `p`.
35
34
 
36
35
  Returns:
37
- The divergence over the broadcast batch, of shape `(...)`: one
38
- value per pair of distributions, reducing the last dimension
39
- only, so an unbatched `(n,)` pair gives a scalar. Implementations
40
- must return a nonnegative value that vanishes at the
41
- divergence's centre. For every divergence except an entropic
42
- transport cost the centre is `p == q`; for
36
+ The divergence over the broadcast batch, of shape `(...)`, with
37
+ one value per pair of distributions. Only the last dimension is
38
+ reduced, so an unbatched `(n,)` pair gives a scalar.
39
+ Implementations must return a nonnegative value that vanishes
40
+ at the divergence's centre. For every divergence except an
41
+ entropic transport cost the centre is `p == q`. For
43
42
  `optora.divergences.EntropicTransportDivergence` it is the
44
43
  kernel-smoothed reference, as documented there.
45
44
  """