| 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) |
| 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`, `modules/mamba2.py`, `modules/mamba3.py`, |
| `modules/ssd_minimal.py`, `ops/selective_scan_interface.py`, |
| `ops/triton/layernorm_gated.py`, and `utils/torch.py`, byte-identical to |
| the upstream commit recorded in _vendor/MANIFEST.json, except for |
| import-path patches, optional-Triton guards, and dispatch patches that |
| choose an implementation per call: on CUDA the authors' fused kernels, and |
| otherwise, for Mamba-1 and Mamba-2, the authors' *own* reference |
| implementations — `selective_scan_fn` -> their `selective_scan_ref`, |
| `mamba_chunk_scan_combined` -> their `ssd_minimal_discrete`, and gated |
| `RMSNorm.forward` -> their `rms_norm_ref`. The adapters presenting the |
| fused kernels' calling convention on top of those references are our own |
| code and live outside this directory, in |
| src/torch_dimensions/mixers/mamba2_compat.py. |
| Statement of changes (§4(b)): every modified line is tagged |
| "torch-dimensions patch" |
| beside the files |
| 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. |
|
|
| 3. DERIVATION — MAMBA-3'S SCAN, WHICH IS THE ONE PLACE OUR OWN ARITHMETIC |
| STANDS IN FOR THEIRS. Unlike Mamba-1 and Mamba-2, Mamba-3 ships no |
| pure-torch reference: its recurrence exists upstream only as Triton |
| kernels (`ops/triton/mamba3 |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |