C-FoundationStereo
NVIDIA's releases of FoundationStereo for commercial use, including a distilled fast variant. The licence differs by variant, see the table.
stable Fork of NVIDIA/tao_pytorch_backend@77fb1a4 · backends: portable, kernels
- Paper FoundationStereo: Zero-Shot Stereo Matching CVPR 2025 · first released 17 Jan 2025
- Authors’ code NVlabs/FoundationStereo (PyTorch), not the code forked here: The research repos (NVlabs/FoundationStereo, NVlabs/Fast-FoundationStereo) have non-commercial licences; NVIDIA's TAO code is Apache-2.0 and its commercial checkpoints load there.
Paper 2025 Added in 0.1.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import stereo
model = stereo.load("c-foundationstereo-s") # kernels on a supported GPU, else portable PyTorch
result = model(left, right)
result.disparity
result.backend # what ran: mode, device, dtype, kernels fastforks bench c-foundationstereo-s Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | out of memory | – | – | – | – |
| Original fp16reference implementation (FoundationStereo repo code) with the C-FS-S checkpoint, AMP; NVIDIA's TAO code OOMs (fp32) or errors (AMP) in the same harness | fp16 | 3874 | – | 8,338 MiB/12.6 GiB | – | – |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 3633 | 1.1× | 6,301 MiB/6,430 MiB | 1.0 | 3.64 |
| Kernels | fp16 | 1366 | 2.8× | 3,058 MiB/4,408 MiB | 0.8 | 1.36 |
| Portable + torch.compile | 2773 | 1.4× | 7,298 MiB/7,624 MiB | 626 (build) | – | |
| TensorRT fp16 | fp16 | 2229 | 1.7× | 9,682 MiBenginenot comparable | 444 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-10-09 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | out of memory | – | 994x1482 | |
| Portable | fp16 | out of memory | – | 994x1482 | ||
| Portable | fp32 | out of memory | – | 994x1482 | ||
| Kernels | fp16 | not implemented | – | 994x1482 | ||
| NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 4281 | 6,285 MiB/6,590 MiB | – | 994x1482 |
| Kernels | fp16 | 1908 | 3,198 MiB/4,328 MiB | – | 994x1482 | |
| NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 1389 | 6,285 MiB/6,570 MiB | – | 994x1482 |
| Kernels | fp16 | 551 | 3,198 MiB/4,328 MiB | – | 994x1482 | |
| NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 3089 | 6,285 MiB/6,590 MiB | – | 994x1482 |
| Kernels | fp16 | 1537 | 3,078 MiB/4,388 MiB | – | 994x1482 | |
| NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07 | Portable | fp16 | 1362 | 5,788 MiB/6,350 MiB | – | 994x1482 |
| Kernels | fp16 | 668 | 3,134 MiB/4,088 MiB | – | 994x1482 | |
| NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08 | Portable | fp16 | 747 | 6,309 MiB/6,450 MiB | – | 994x1482 |
| Kernels | fp16 | 319 | 3,102 MiB/4,248 MiB | – | 994x1482 | |
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0 LICENSENOTICE
- Weights
- LicenseRef-NVIDIA-Open-Model-License source
- Training data
-
- Foundation Stereo Dataset (FSD, NVIDIA synthetic) NVIDIA-Source-Code-License-NC, non-commercial
- CREStereo synthetic stereo dataset (Megvii) not stated
- TartanAir CC-BY-4.0
- fast-foundationstereo is the research checkpoint 23-36-37 (the original demo default, the most accurate released): weights are non-commercial (NVIDIA Source Code License NC); our code here is the Apache-2.0 TAO code, which does not change that. For commercial use take c-foundationstereo-s (its model card says 'ready for commercial use').
- Trained on NVIDIA's FSD dataset, whose terms for commercial use of trained models are unclear; the status does not depend on the training data.
- c-fast-foundationstereo: the weights are governed by the NVIDIA Open Model Agreement, which allows commercial use; the model card's description also calls the model 'for research and evaluation purposes only', which contradicts it. We follow the governing terms.
Our reading of the licences, not legal advice.
Weights
trainable_foundation_stereo_small.pth 538 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download c-foundationstereo-s).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
ETH3D two-view train
bad > 1 px % / EPE
| Run | dtype | bad px % ↓ | EPE ↓ | Δ bad px % vs fp32 original | pairs | ms / pair |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 1.25 | 0.202 | reference | 27 | 2014 |
| Original fp16 | fp16 | 1.25 | 0.201 | ±0.00 | 27 | 913 |
| Portable fp32 | fp32 | 1.25 | 0.201 | ±0.00 | 27 | 2020 |
| Portable | fp16 | 1.25 | 0.201 | ±0.00 | 27 | 866 |
| Kernels | fp16 | 1.24 | 0.202 | +0.01 | 27 | 360 |
Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
Middlebury 2014 trainingH
bad > 2 px % / EPE
| Run | dtype | bad px % ↓ | EPE ↓ | pairs | ms / pair |
|---|---|---|---|---|---|
| Original fp32 | fp32 | out of memory | |||
| Original fp16 | fp16 | out of memory | |||
| Portable fp32 | fp32 | out of memory | |||
| Portable | fp16 | 3.87 | 0.747 | 15 | 3113 |
| Kernels | fp16 | 3.87 | 0.748 | 15 | 1163 |
Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-05; original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-06; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 px and p99 <= 0.25 px.
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.002 px | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.02 px | 0.00044 px |
| GPU default dtypes, p99 |diff| | ≤ 0.25 px | 0.00146 px |
Recorded for c-foundationstereo-s on RTX 5060 Ti, torch 2.14.1+cu130, 2026-10-31, with these kernels: cfscudnn_hacccutlass_convfastbbffs_cutlassfsfs_cutlassigev
Details
NVIDIA's commercially licensed FoundationStereo releases (TAO code): C-FoundationStereo-S (DepthAnything-ViT-S + CNN features, 3D cost-volume filtering with disparity transformer, ConvGRU, 22 iterations), the distilled C-Fast-FoundationStereo (EdgeNeXt features, 8 iterations) and the same network with the research checkpoint (Fast-FoundationStereo).
- Input / output
- Input: a rectified left / right image pair. Output: a disparity map (pixels, left view).
- Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 1024x2048 (8,488 MiB allocated)
- Options
iters=0>= 0· changes the output
- Outputs
disparity- CUDA kernels
igevIGEV stereo: convolution epilogues, correlation lookups, GRU gatescutlass_convCUTLASS convolutions with the recurrent update (GRU) fused incudnn_haccconvolutions with fp16 accumulation (cuDNN)fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbonesfsFoundationStereo: fused epilogues, geometry lookups, GRU gatesfs_cutlassFoundationStereo: CUTLASS convolutions with fused epiloguescfsC-FoundationStereo-S transformer kernelsffs_cutlassFast-FoundationStereo: fused CUTLASS convolutions
- Apple (MPS)
- fp32, fp16
Limitations
- ONNX export needs torch >= 2.14 (older exporters fail on this network).
Full reference, generated from the repository
NVIDIA's releases of FoundationStereo for commercial use, including a distilled fast variant. The licence differs by variant, see the table.
Commercial use: c-foundationstereo-s, c-fast-foundationstereo: yes; fast-foundationstereo: no (weights: LicenseRef-NVIDIA-Source-Code-License-NC).
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
c-foundationstereo-s | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | OOM 3874 3633 1366 2773 2229 | – 8338 / 12870 6301 / 6430 3058 / 4408 7298 / 7624 10027 / 10108 |
c-fast-foundationstereo (max_disp 192, valid_iters 8) | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 741 527 330 135 339 451 | 4569 / 5358 2892 / 2996 2109 / 2336 1120 / 1236 1649 / 1792 1425 / 1462 |
fast-foundationstereo (max_disp 192, valid_iters 8) | Middlebury 2014 half (994x1482) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 741 527 330 135 339 156 | 4616 / 5408 2939 / 3306 2109 / 2256 1120 / 1236 1613 / 1752 1342 / 1398 |
Details
- Original code: https://github.com/NVIDIA/tao_pytorch_backend at
77fb1a4bca02 - Code licence: Apache-2.0 (permissive); files:
LICENSE,NOTICE - Weights licence: LicenseRef-NVIDIA-Open-Model-License
c-fast-foundationstereo: LicenseRef-NVIDIA-Open-Model-Agreementfast-foundationstereo: LicenseRef-NVIDIA-Source-Code-License-NC
- Licence evidence: https://huggingface.co/nvidia/c-foundationstereo-s/blob/d776ba855977e99cc9f16246f911d701da0bbc7a/README.md
- Training data: Foundation Stereo Dataset (FSD, NVIDIA synthetic), CREStereo synthetic stereo dataset (Megvii), TartanAir (pretrained on the Foundation Stereo Dataset (FSD, NVIDIA synthetic) and CREStereo, fine-tuned on FSD and TartanAir)
c-fast-foundationstereo: Foundation Stereo Dataset (FSD, NVIDIA synthetic), NVIDIA internal proprietary data, Stereo4D (stereo YouTube videos) (large synthetic NVIDIA set (1.4 M pairs; 'internal, proprietary dataset') plus real Stereo4D)fast-foundationstereo: Foundation Stereo Dataset (FSD, NVIDIA synthetic) (Foundation Stereo Dataset (FSD, NVIDIA synthetic) plus further real and synthetic data, distilled from FoundationStereo; no per-dataset terms checked)
- Licence note: fast-foundationstereo is the research checkpoint 23-36-37 (the original demo default, the most accurate released): weights are non-commercial (NVIDIA Source Code License NC); our code here is the Apache-2.0 TAO code, which does not change that. For commercial use take c-foundationstereo-s (its model card says 'ready for commercial use').
- Licence note: Trained on NVIDIA's FSD dataset, whose terms for commercial use of trained models are unclear; the status does not depend on the training data.
- Licence note: c-fast-foundationstereo: the weights are governed by the NVIDIA Open Model Agreement, which allows commercial use; the model card's description also calls the model 'for research and evaluation purposes only', which contradicts it. We follow the governing terms.
- Options:
iters= 0 (>= 0) - Kernel libraries:
igev,cutlass_conv,cudnn_hacc,fastbb,fs,fs_cutlass,cfs,ffs_cutlass - Variants:
c-foundationstereo-s,c-fast-foundationstereo,fast-foundationstereo - Outputs: disparity
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
c-foundationstereo-s1024x2048 (8.3 GiB peak allocated, 11.1 reserved);c-fast-foundationstereo1988x2880 (9.3 GiB peak allocated, 12.3 reserved);fast-foundationstereo1988x2880 (9.3 GiB peak allocated, 12.3 reserved) c-foundationstereo-s994x1482, first call: portable + torch.compile 626 s (cold Inductor cache), TensorRT fp16 444 s (ONNX + engine).c-fast-foundationstereo994x1482, first call: portable + torch.compile 75 s (cold Inductor cache), TensorRT fp16 240 s (ONNX + engine).fast-foundationstereo994x1482, first call: portable + torch.compile 78 s (cold Inductor cache), TensorRT fp16 157 s (ONNX + engine).c-foundationstereo-soriginal 994x1482: reference implementation (FoundationStereo repo code) with the C-FS-S checkpoint, AMP; NVIDIA's TAO code OOMs (fp32) or errors (AMP) in the same harnessc-foundationstereo-sload / first call: original 1.67 s / 2.731 s (375x1242), portable 0.96 s / 2.087 s (375x1242), kernels 0.81 s / 1.376 s (375x1242)c-fast-foundationstereoload / first call: original 0.17 s / 0.172 s (375x1242), portable 0.24 s / 0.332† s, kernels 0.72 s / 0.552 s (375x1242)fast-foundationstereoload / first call: original 0.16 s / 0.144 s (375x1242), portable 0.25 s / 0.33† s, kernels 0.6 s / 0.493 s (375x1242)- † measured in the speed sweep after the portable load (or an earlier size) in the same process: file cache and kernels are warm, so the time is lower than a fresh start.
- Protocol,
c-foundationstereo-s: first call, 3 warm-up, peak reset, median of 3 rounds x median of 5 - Protocol,
c-fast-foundationstereo,fast-foundationstereo: median of 5 after 3 warm-up, uint8 CUDA input (synthetic for bench_inputs sizes), card defaults; gc before each load; peak = max over the first call and the timed calls
Measured
Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
c-foundationstereo-s | ETH3D two-view train, bad > 1 px % / EPE | 1.25 / 0.202 | 1.25 / 0.201 | 1.25 / 0.201 | 1.25 / 0.201 | 1.24 / 0.202 | |
c-foundationstereo-s | Middlebury 2014 trainingH, bad > 2 px % / EPE | out of memory | out of memory | 3.87 / 0.747 | out of memory | 3.87 / 0.748 | |
c-fast-foundationstereo | ETH3D two-view train, bad > 1 px % / EPE | 2.20 / 0.255 | 2.21 / 0.254 | 2.20 / 0.254 | 2.20 / 0.254 | 2.20 / 0.256 | |
c-fast-foundationstereo | Middlebury 2014 trainingH, bad > 2 px % / EPE | 7.82 / 1.861 | 7.82 / 1.858 | 7.81 / 1.853 | 7.82 / 1.863 | 7.82 / 1.856 | |
fast-foundationstereo | ETH3D two-view train, bad > 1 px % / EPE | 1.72 / 0.249 | 1.72 / 0.248 | 1.72 / 0.248 | 1.72 / 0.249 | 1.72 / 0.249 | |
fast-foundationstereo | Middlebury 2014 trainingH, bad > 2 px % / EPE | 7.16 / 1.609 | 7.16 / 1.608 | 7.16 / 1.608 | 7.16 / 1.609 | 7.17 / 1.606 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 468fba10, 2026-11-05.
Parity
CPU, float32: max |diff| <= 0.002 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.02 px and p99 <= 0.25 px.
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
c-foundationstereo-s | 0.00044 / 0.00146 | RTX 5060 Ti, torch 2.14.1+cu130 | cfs@ef8fd8e49913:sm_120, cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, ffs_cutlass@645e15d6e6ee:sm_120, fs@f6f8de2cca1e:sm_120, fs_cutlass@de5f3c10aa1b:sm_120, igev@f075827d68c6:sm_120 |
c-fast-foundationstereo | 0.001 / 0.00212 | RTX 5060 Ti, torch 2.14.1+cu130 | cfs@ef8fd8e49913:sm_120, cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, ffs_cutlass@645e15d6e6ee:sm_120, fs@f6f8de2cca1e:sm_120, fs_cutlass@de5f3c10aa1b:sm_120, igev@f075827d68c6:sm_120 |
fast-foundationstereo | 0.00072 / 0.002 | RTX 5060 Ti, torch 2.14.1+cu130 | cfs@ef8fd8e49913:sm_120, cudnn_hacc@cudnn92400, cutlass_conv@988138e042cb:sm_120, fastbb@7d058322634d:sm_120, ffs_cutlass@645e15d6e6ee:sm_120, fs@f6f8de2cca1e:sm_120, fs_cutlass@de5f3c10aa1b:sm_120, igev@f075827d68c6:sm_120 |
Limitations
- ONNX export needs torch >= 2.14 (older exporters fail on this network).
Example output
One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).
Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).