API Reference¶
Complete reference for jacobi v0.1.2 (Rust edition 2024, MSRV 1.85). Every public type, trait, and function is organized by domain below with exact Rust signatures, behavior notes, and runnable snippets.
Quick Import¶
Start every binary or module with the prelude.
Reference Sections¶
| Section | Modules Covered | Key Symbols |
|---|---|---|
| Tensors, Dtypes, and RNG | jacobi::tensor, jacobi::rng, Dtype, Precision |
Tensor, einsum, einsum_in, Dtype, Precision, manual_seed, randn, top_k, cholesky, svd, rfft, conv2d |
| Transforms and Distributed | jacobi::transform |
jit, grad, value_and_grad, efficient_grad, jvp, hvp, vmap, checkpoint, custom_vjp, for_loop, scan, cond, pmap, Mesh, shard_map, all_to_all_axis |
| Modules and Neural Networks | jacobi::module, jacobi::nn |
#[module], Module, Linear, LoraLinear, Sequential, MultiheadAttention, RoPE, KvCache, nn::flash_attention, nn::moe_swiglu_dispatch_all_to_all, nn::chunked_cross_entropy, nn::quantized_matmul |
| Optimizers and Schedules | jacobi::optim |
Sgd, Adam, AdamW, EfficientAdamW, RMSprop, Muon, Ema, clip_grad_norm, warmup_cosine, wsd_schedule |
| Runtime, FFI, Hub, and I/O | jacobi::runtime, jacobi::ffi, jacobi::hub, jacobi::io, jacobi::error |
Backend, Engine, DataLoader, HostTensor, init_distributed, memory_stats, register_ffi_handler, to_dlpack, hub::weights, HfExporter, Tokenizer, io::safetensors, io::onnx, io::serve, Error, Result |
Design Conventions¶
- Lazy Error Propagation Tensor operations always return
Tensorand never panic mid-expression. Shape, dtype, or runtime errors attach to the tensor graph and surface asErr(Error)on.item()?,.to_vec_f32()?,.to_host()?,.check()?, orjit.call(...)?, carrying the caller's Rust file and line via#[track_caller]. - Functional Autodiff Gradients are computed functionally via
gradandvalue_and_gradrather than mutating.gradfields. Optimizers hold only optimizer state and update models in place viaopt.step(&mut model, &grads). - Implicit Device RNG Random constructors (
Tensor::randn,Tensor::randperm,nn::dropout,logits.sample()) advance an implicit device-resident Philox PRNG seeded withmanual_seed(seed), remaining deterministic across eager execution,jit,for_loop, andvmap. - Channels-Last Convolutions
Conv1d([B, L, C]),Conv2d([B, H, W, C]),Conv3d([B, D, H, W, C]),BatchNorm2d,GroupNorm, and pooling layers use channels-last tensor layout with PyTorch constructor argument order(in_channels, out_channels, kernel_size). - Automatic Hardware Dispatch
nn::flash_attentiondispatches to NVIDIA cuDNN FlashAttention-2/3 on CUDA (16 <= D <= 256),nn::quantized_matmulandMoeDispatchConfig::default()auto-detect CUDA/TPU FP8 Tensor Cores, and dynamic FP8 backward GEMMs auto-enable on Blackwell (sm_100) and TPU while defaulting to fasterBF16backward on Hopper (sm_90).
Machine-Readable Reference for AI Assistants¶
Point Claude, Gemini, ChatGPT, Grok, Muse, Perplexity, or coding agents at llms.txt for the concise ground-truth API map, or llms-full.txt for the complete single-file reference bundle.