Models · Stereo matching

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.
Checkpoint

Paper 2025 Added in 0.1.0 Evaluated with 0.2.0

Kernels, RTX 5060 Ti 16 GB 1366 ms 994x1482, fp16
vs the faster original 2.8× original fp16: 3874 ms
Peak memory 3,058 MiB original: 8,338 MiB
Accuracy vs original fp32 +0.01 kernels bad px %, ETH3D two-view train (1.25 original)

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.

BackenddtypeTime per call (ms)vs original fp16Peak memory
allocated / reserved
Load (s)First call (s)
Original fp32fp32out 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 harnessfp16 3874–8,338 MiB/12.6 GiB––
Portable fp32fp32not measured ––––
Portablefp16 36331.1×6,301 MiB/6,430 MiB1.03.64
Kernelsfp16 13662.8×3,058 MiB/4,408 MiB0.81.36
Portable + torch.compile 27731.4×7,298 MiB/7,624 MiB626 (build)–
TensorRT fp16fp16 22291.7×9,682 MiBenginenot comparable444 (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

DeviceBackenddtypems / callPeak memoryOutput vs referenceInput
Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14Originalfp32out of memory–994x1482
Portablefp16out of memory–994x1482
Portablefp32out of memory–994x1482
Kernelsfp16not implemented–994x1482
NVIDIA L4 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp164281 6,285 MiB/6,590 MiB–994x1482
Kernelsfp161908 3,198 MiB/4,328 MiB–994x1482
NVIDIA L40S CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp161389 6,285 MiB/6,570 MiB–994x1482
Kernelsfp16551 3,198 MiB/4,328 MiB–994x1482
NVIDIA A10 CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp163089 6,285 MiB/6,590 MiB–994x1482
Kernelsfp161537 3,078 MiB/4,388 MiB–994x1482
NVIDIA A100-SXM4-40GB CUDA, torch 2.14.1+cu130, 2026-11-07Portablefp161362 5,788 MiB/6,350 MiB–994x1482
Kernelsfp16668 3,134 MiB/4,088 MiB–994x1482
NVIDIA RTX PRO 6000 CUDA, torch 2.14.1+cu130, 2026-11-08Portablefp16747 6,309 MiB/6,450 MiB–994x1482
Kernelsfp16319 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
  • 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 Face

fastforks 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

Rundtypebad px % ↓EPE ↓Δ bad px % vs fp32 originalpairsms / pair
Original fp32fp321.250.202 reference 27 2014
Original fp16fp161.250.201 ±0.00 27 913
Portable fp32fp321.250.201 ±0.00 27 2020
Portablefp161.250.201 ±0.00 27 866
Kernelsfp161.240.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

Rundtypebad px % ↓EPE ↓pairsms / pair
Original fp32fp32out of memory
Original fp16fp16out of memory
Portable fp32fp32out of memory
Portablefp163.870.747 15 3113
Kernelsfp163.870.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.

CheckToleranceMeasured
CPU fp32, max |diff|≤ 0.002 pxnot recorded
GPU default dtypes, mean |diff|≤ 0.02 px0.00044 px
GPU default dtypes, p99 |diff|≤ 0.25 px0.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 gates
  • cutlass_convCUTLASS convolutions with the recurrent update (GRU) fused in
  • cudnn_haccconvolutions with fp16 accumulation (cuDNN)
  • fastbbfast backbone kernels: flash attention, window attention, instance norm and rotary embeddings for ViT and similar backbones
  • fsFoundationStereo: fused epilogues, geometry lookups, GRU gates
  • fs_cutlassFoundationStereo: CUTLASS convolutions with fused epilogues
  • cfsC-FoundationStereo-S transformer kernels
  • ffs_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).

variantinputbackendtime (ms)peak memory (MiB, allocated / reserved)
c-foundationstereo-sMiddlebury 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-Agreement
    • fast-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-s 1024x2048 (8.3 GiB peak allocated, 11.1 reserved); c-fast-foundationstereo 1988x2880 (9.3 GiB peak allocated, 12.3 reserved); fast-foundationstereo 1988x2880 (9.3 GiB peak allocated, 12.3 reserved)
  • c-foundationstereo-s 994x1482, first call: portable + torch.compile 626 s (cold Inductor cache), TensorRT fp16 444 s (ONNX + engine).
  • c-fast-foundationstereo 994x1482, first call: portable + torch.compile 75 s (cold Inductor cache), TensorRT fp16 240 s (ONNX + engine).
  • fast-foundationstereo 994x1482, first call: portable + torch.compile 78 s (cold Inductor cache), TensorRT fp16 157 s (ONNX + engine).
  • c-foundationstereo-s original 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 harness
  • c-foundationstereo-s load / 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-foundationstereo load / 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-foundationstereo load / 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.

variantdatasetoriginal fp32original fp16portableportable fp32kernelsnote
c-foundationstereo-sETH3D two-view train, bad > 1 px % / EPE1.25 / 0.2021.25 / 0.2011.25 / 0.2011.25 / 0.2011.24 / 0.202
c-foundationstereo-sMiddlebury 2014 trainingH, bad > 2 px % / EPEout of memoryout of memory3.87 / 0.747out of memory3.87 / 0.748
c-fast-foundationstereoETH3D two-view train, bad > 1 px % / EPE2.20 / 0.2552.21 / 0.2542.20 / 0.2542.20 / 0.2542.20 / 0.256
c-fast-foundationstereoMiddlebury 2014 trainingH, bad > 2 px % / EPE7.82 / 1.8617.82 / 1.8587.81 / 1.8537.82 / 1.8637.82 / 1.856
fast-foundationstereoETH3D two-view train, bad > 1 px % / EPE1.72 / 0.2491.72 / 0.2481.72 / 0.2481.72 / 0.2491.72 / 0.249
fast-foundationstereoMiddlebury 2014 trainingH, bad > 2 px % / EPE7.16 / 1.6097.16 / 1.6087.16 / 1.6087.16 / 1.6097.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.

variantkernels error vs original, mean / p99GPU, torchkernels used
c-foundationstereo-s0.00044 / 0.00146RTX 5060 Ti, torch 2.14.1+cu130cfs@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-foundationstereo0.001 / 0.00212RTX 5060 Ti, torch 2.14.1+cu130cfs@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-foundationstereo0.00072 / 0.002RTX 5060 Ti, torch 2.14.1+cu130cfs@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).

Left view
Right view
Output
Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), left view
Left view · 100%

Input: Motorcycle, Middlebury 2014 stereo (left and right view, downscaled 4x), Scharstein et al., Middlebury College (research dataset, no licence stated).