# Clorch ## Docs - [Clorch: LibTorch Deep Learning Bindings for Clojure](https://antlobach-clorch-182a83cb.mintlify.app/introduction.md): Explore Clorch's PyTorch-style tensor ops, autograd, nn modules, distributed CUDA training, and LLM components — all from an idiomatic Clojure REPL. - [Installing Clorch and Configuring CPU or CUDA Backends](https://antlobach-clorch-182a83cb.mintlify.app/installation.md): Set up Clorch via git coordinates in deps.edn, choose between CPU and CUDA backends, install GPU system packages, and launch an nREPL dev server. - [Clorch Quickstart: Tensors, Models, and Training Loops](https://antlobach-clorch-182a83cb.mintlify.app/quickstart.md): Build your first Clorch program: create tensors, compute gradients, define neural networks with defmodel, run a training loop, and move models to CUDA. - [Tensors and Operations: The Complete Clorch Reference](https://antlobach-clorch-182a83cb.mintlify.app/concepts/tensors.md): Create and transform LibTorch tensors from Clojure: factory methods, dtypes, element-wise math, shape operations, search utilities, and JIT save/load. - [Automatic Differentiation with Clorch's Autograd Engine](https://antlobach-clorch-182a83cb.mintlify.app/concepts/autograd.md): How Clorch wraps LibTorch's native reverse-mode AD engine to compute gradients, control graph tracking, and wire backward passes into a training loop. - [Native Memory Management in Clorch: A Practical Guide](https://antlobach-clorch-182a83cb.mintlify.app/concepts/memory.md): Why tensors live outside the JVM heap, when to use with-torch scopes, how to retain or release pointers, and how to prevent memory leaks in hot loops. - [Building Neural Networks in Clorch: Layers and Lifecycle](https://antlobach-clorch-182a83cb.mintlify.app/models/neural-networks.md): Complete reference for clorch.nn: linear, conv, recurrent, normalization, pooling, defmodel macro, lifecycle API, and model inspection with nn/summary. - [Stateless Operations with the Clorch Functional API](https://antlobach-clorch-182a83cb.mintlify.app/models/functional.md): Reference for clorch.nn.functional: stateless convolutions, pooling, normalization, dropout, padding, attention, and when to prefer F/ over nn/ modules. - [Clorch Activation Functions: Module and Functional](https://antlobach-clorch-182a83cb.mintlify.app/models/activations.md): All Clorch activations in nn/ and F/ forms: ReLU, GeLU, SiLU, ELU, SELU, softmax, shrinkage, Mish, Hardswish, and more with output range comparison table. - [Loss Functions for Regression and Classification Tasks](https://antlobach-clorch-182a83cb.mintlify.app/models/losses.md): Reference for Clorch loss functions — MSE, L1, Huber, cross-entropy, NLL, BCE — with autograd notes and the zero-grad → backward → step training pattern. - [Optimizers: SGD, Adam, AdamW, RMSprop, and Adagrad](https://antlobach-clorch-182a83cb.mintlify.app/models/optimizers.md): Clorch optimizer reference — SGD, Adam, AdamW, RMSprop, Adagrad constructors, key options, zero-grad/step lifecycle, and a complete train-step example. - [Clorch Parameter Initialization: Xavier and Kaiming](https://antlobach-clorch-182a83cb.mintlify.app/models/init.md): Initialize weights with clorch.nn.init — constant, uniform, normal, Xavier/Glorot, and Kaiming/He initializers — with defmodel integration patterns. - [Complete PyTorch-to-Clorch Tensor Slicing Reference](https://antlobach-clorch-182a83cb.mintlify.app/advanced/slicing.md): Map every PyTorch indexing pattern to Clorch ix: integer indices, ranges, stepped slices, negative-step reversal, ellipsis, and boolean mask indexing. - [Probability Distributions for Bayesian and Generative Models](https://antlobach-clorch-182a83cb.mintlify.app/advanced/distributions.md): clorch.distributions offers data-first constructors, shape-aware sampling, log-prob, and closed-form moments for normal, categorical, gamma, and more. - [Multi-GPU Distributed Training with NCCL, DDP, and AMP](https://antlobach-clorch-182a83cb.mintlify.app/advanced/distributed.md): NCCL workers, collective ops, DDP gradient sync, gradient accumulation, distributed sampling, and atomic rank-zero checkpoints in one Clorch workflow. - [Automatic Mixed Precision: float16, bfloat16, and AMP](https://antlobach-clorch-182a83cb.mintlify.app/advanced/amp.md): clorch.amp provides autocast for float16 or bfloat16, dynamic gradient scaling via grad-scaler, and DDP-aware optimizer stepping with overflow detection. - [Custom Datasets, Dataloaders, and Distributed Sampling](https://antlobach-clorch-182a83cb.mintlify.app/advanced/data-loading.md): Create IDataset implementations, configure batching and shuffle, prefetch with thread or process workers, and shard data across distributed training ranks. - [LLM Architecture Components: RoPE, GQA, SwiGLU, and More](https://antlobach-clorch-182a83cb.mintlify.app/advanced/llm-components.md): RMSNorm, RoPE, grouped-query attention, SwiGLU, fused SDPA, KV cache, and autoregressive generation: the full set of LLM components available in Clorch. - [Performance Profiling and Memory Diagnostics in Clorch](https://antlobach-clorch-182a83cb.mintlify.app/advanced/profiling.md): Maximize Clorch throughput: prefer vectorized ops over Clojure loops, use no-grad at inference, monitor native RSS for leaks, and batch JNI calls. - [PyTorch Parity: Measured API Coverage and Gap Roadmap](https://antlobach-clorch-182a83cb.mintlify.app/reference/pytorch-parity.md): Measured numerical parity results, a capability comparison across all PyTorch areas, LLM architecture coverage, and the 8-step roadmap to full API parity. - [Clorch Example Programs: A Guided Code Walkthrough](https://antlobach-clorch-182a83cb.mintlify.app/reference/examples.md): Hands-on walkthroughs of every example shipped with Clorch, from a minimal defmodel to distributed multi-GPU DDP training and Bayesian MCMC inference. - [Clorch Namespace Map: Every Public Symbol Explained](https://antlobach-clorch-182a83cb.mintlify.app/reference/namespace-map.md): Every Clorch namespace, its purpose, and the key public symbols it exports — from core tensor ops to distributed training, AMP, and the einsum eDSL. This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.