ferrotorch
Top-level re-export crate for the ferrotorch deep learning framework.
What it provides
This is the umbrella crate that re-exports all ferrotorch sub-crates through a single dependency. Add ferrotorch to your Cargo.toml and access everything via submodules:
Always included
- ferrotorch-core — Tensor, autograd, 80+ differentiable ops, complex / sparse / named tensors, FFT, signal, masked, quantization, einops
- ferrotorch-nn — Module trait, 30+ layers (Linear, Conv1d/2d, LSTM, GRU, Attention, norms, activations, lazy modules), losses, LoRA
- ferrotorch-optim — 18 optimizers (SGD, Adam, AdamW, Adamax, NAdam, RAdam, Adagrad, Adadelta, Adafactor, RMSprop, Rprop, ASGD, SparseAdam, L-BFGS, Muon, K-FAC, EMA, SWA), 12+ LR schedulers, gradient clipping
- ferrotorch-data — Dataset, DataLoader (parallel via rayon), DistributedSampler, collation, transforms, Apache Arrow / Polars interop (feature
arrow) - ferrotorch-vision — 10 classification (ResNet, VGG, ViT-B/16, EfficientNet-B0, ConvNeXt-T, Swin-T, MobileNetV2, MobileNetV3, DenseNet-121, InceptionV3), 3 detection (Faster R-CNN, Mask R-CNN, SSD300), 2 segmentation (DeepLabV3, FCN), plus U-Net and YOLO; MNIST/CIFAR/ImageFolder datasets; image I/O
Default features (opt-out with default-features = false)
- ferrotorch-train — Learner training loop, callbacks, metrics, checkpointing
- ferrotorch-serialize — ONNX export (via IrGraph), PyTorch .pt import, SafeTensors, GGUF (parse/load/dequantize)
- ferrotorch-jit — Tracing JIT, IR graph, optimization passes, code generation
- ferrotorch-jit-script —
#[script]proc macro for source-based graph capture - ferrotorch-distributions — Probability distributions for sampling and VI
- ferrotorch-profiler — Performance profiling with Chrome trace export
- ferrotorch-hub — Model hub for downloading and caching pretrained weights
- ferrotorch-tokenize — HuggingFace tokenizer wrapper (BPE, WordPiece, Unigram)
Optional features (opt-in)
gpu— NVIDIA CUDA backend with PTX kernels, cuBLAS, cuSOLVER, cuFFT (cargo add ferrotorch --features gpu)cubecl— Portable GPU via CubeCL: CUDA + WGPU/AMD + ROCm (--features cubecl)mps— Apple Silicon Metal Performance Shaders backend (--features mps)xpu— Intel Arc / Data Center GPU Max via CubeCL wgpu (--features xpu)distributed— DDP, collective ops, TCP / Gloo backends (--features distributed)llama— Llama 3 model composition + GPU bf16 inference (--features llama)ml— Sklearn-compatible adapter and classic-ML datasets (--features ml)
Quick start
use *;
Submodules
// Always-on submodules (matching the `[features]` defaults):
use *; // layers, losses, activations
use *; // optimizers, schedulers
use *; // datasets, dataloaders, samplers
use *; // models, transforms
use *; // Learner, callbacks, metrics
use *; // SafeTensors, GGUF, ONNX, PyTorch import
use *; // tracing JIT, IR graph
use *; // probability distributions
use *; // Profiler, Chrome trace export
use *; // pretrained model registry + cache
use *; // HuggingFace tokenizer wrapper
// Feature-gated submodules (opt-in via the matching feature flag):
// use ferrotorch::gpu::*; // `gpu` — CUDA backend
// use ferrotorch::cubecl::*; // `cubecl` — portable CUDA/WGPU/ROCm
// use ferrotorch::mps::*; // `mps` — Apple Silicon Metal
// use ferrotorch::xpu::*; // `xpu` — Intel Arc via CubeCL wgpu
// use ferrotorch::distributed::*; // `distributed` — DDP, collectives, TCP/Gloo
// use ferrotorch::llama::*; // `llama` — Llama 3 model + inferencer
// use ferrotorch::ml::*; // `ml` — sklearn-compatible adapter
Part of ferrotorch
This is the top-level crate of the ferrotorch workspace. See the workspace README for full documentation.
License
MIT OR Apache-2.0