torch-dimensions
Copyright © 2026 Celsia Juilyn Fan

This product includes software developed by the torch-dimensions authors,
licensed under the Apache License, Version 2.0 (see LICENSE).

================================================================================
Third-party attributions
================================================================================

Each entry below states its relationship to the upstream project exactly:
**redistribution** (their files, shipped verbatim in this package),
**derivation** (our files, written from their code), or **ideas** (no code
relationship at all). The audit behind this list is in dossier/README.md.

--------------------------------------------------------------------------------
state-spaces/s4 — Apache License 2.0
Copyright the state-spaces authors (Gu, Goel, Ré, et al.)
https://github.com/state-spaces/s4

1. REDISTRIBUTION. src/torch_dimensions/_vendor/s4/src/ contains the
   pipeline subtree that upstream's train.py runs: the S4Block layer
   (`src/models/sequence/modules/s4block.py`), the S4ND layer (`s4nd.py`),
   the kernel modules (`fftconv.py`, `ssm.py`, `dplr.py`, `kernel.py`), the
   HiPPO construction, the functional kernels (`cauchy.py`, `vandermonde.py`,
   `krylov.py`, `toeplitz.py`), the `nn` components, and the `utils`
   config/registry/train modules — 23 files, byte-identical to the upstream
   commit recorded in _vendor/MANIFEST.json, with their directory structure
   intact so the code's own `src.*` imports run unchanged. Statement of
   changes (Apache-2.0 §4(b)): exactly two files are modified.
   `src/utils/train.py` guards its training-only imports
   (pytorch_lightning, rich, omegaconf). `src/models/sequence/kernels/ssm.py`
   adds a Nyquist-pole guard in `_omega`: the bilinear transform divides by
   (1 + omega), which is zero when a backend's power op lands exactly on
   omega = -1 (MPS does at some lengths); the guard nudges only an exact hit
   and is inert on CPU/CUDA, where outputs are verified bit-for-bit
   unchanged. Every changed line is tagged "torch-dimensions patch", pristine
   copies ship as `.orig` beside both files, and tests/test_vendored.py fails
   if any untagged difference exists anywhere. The upstream LICENSE ships in
   the same directory.

2. DERIVATION. src/torch_dimensions/mixers/ssm.py derives the S4D and S4
   (DPLR) kernel mathematics from `models/s4/s4d.py` and the structured-kernel
   modules. Modified: the fused CUDA/Triton kernels, the pytorch_lightning and
   hub imports, and the transposed-layout plumbing are not carried over, and a
   Nyquist-pole guard was added that upstream does not have. That file's
   module docstring states this in full.

Upstream ships no NOTICE file, so there is none to propagate.

--------------------------------------------------------------------------------
state-spaces/mamba — Apache License 2.0
Copyright (c) 2023, Tri Dao, Albert Gu.
https://github.com/state-spaces/mamba

1. REDISTRIBUTION. src/torch_dimensions/_vendor/mamba/ contains the authors'
   `modules/mamba_simple.py`, `ops/selective_scan_interface.py`, and
   `utils/torch.py`, byte-identical to the upstream commit recorded in
   _vendor/MANIFEST.json, except for import-path patches, an optional-Triton
   guard, and one functional patch: `selective_scan_fn` dispatches to the
   authors' own `selective_scan_ref` when the CUDA extension is absent.
   Statement of changes (§4(b)): every modified line is tagged
   "torch-dimensions patch"; `.orig` copies and the upstream LICENSE ship
   beside the files; tests/test_vendored.py enforces that no other
   modification exists.

2. DERIVATION. src/torch_dimensions/mixers/ssm.py derives the selective-scan
   recurrence from `modules/mamba_simple.py`. Modified: the scan is a portable
   sequential loop rather than the fused kernel.

Upstream ships no NOTICE file.

--------------------------------------------------------------------------------
BaratiLab/CaFA — MIT License
Copyright (c) 2024 BaratiLab
https://github.com/BaratiLab/CaFA

No code is copied. Two design ideas in
src/torch_dimensions/compose/attention.py come from their `LowRankKernel`:
query/key RMS normalization (`qk_norm=`), and a learnable `gamma * I` added to
the kernel before the gate (`kernel_residual=`). Both are independently
implemented here and both default to off. Their rotary position embedding and
spherical quadrature weights are deliberately not adopted.

--------------------------------------------------------------------------------
jacklishufan/Mamba-ND — NO LICENSE
https://github.com/jacklishufan/Mamba-ND

**The upstream repository states no license**, as of 2026-08-02 and at the
commit cloned on 2026-06-21 — no LICENSE, no NOTICE, no COPYING, at any depth.
Under default copyright that means no grant to copy, modify, or redistribute.

Note also that eight files in that repository carry `Copyright (c) OpenMMLab`
headers. OpenMMLab's projects are Apache-2.0, which asks a redistributor to
include the license and retain notices. That is a matter between those
projects and Mamba-ND's authors, not something this project takes a position
on; it is recorded because it is a second, independent reason to keep that
repository at arm's length.

Accordingly: no code from it is present in this project, and none is
redistributed. `dossier/verify_mamba_nd.py` imports their code from a user's
own local clone purely to compare behaviour; nothing in the published package
depends on it.

`ScanPlan.paired()` produces the schedule the paper specifies. Figure 2 of
arXiv:2402.05892 states it in words — "a chain of 1D Mamba layers that process
the sequence in alternating orderings. In 3D space, we use the order H+ H- W+
W- T+ T-" — and our per-layer (axis, direction) sequence was additionally
verified against their reference implementation, layer for layer, on
2026-08-02. What that establishes, and what it does not, stated exactly:

  - The two implementations share no expression. Ours builds `Step` tuples in
    a three-line list comprehension; theirs advances an index (`z = i // 2`)
    over einops rearrange strings. Anyone can compare the two files.
  - `paired()` has been in this repository since its Phase 2 commit
    (0fba849), which predates any contact with their code here.
  - We make **no claim** about which sources informed that original
    implementation. The schedule is published in the paper's Figure 2;
    identical behaviour between two expressions of a published algorithm is
    expected and is not evidence of copying in either direction.

Anyone intending to build on Mamba-ND beyond private study should resolve the
license question with its authors first.
