Skip to main content
This guide walks you from a single tensor all the way to a complete training loop that runs on either CPU or CUDA. Each step builds on the previous one, so by the end you will have seen every core Clorch concept in a working context. All examples run against the real library — nothing is mocked or simplified.

Next Steps

Tensors & Operations

Full reference for tensor creation, dtypes, arithmetic, reductions, slicing with ix, and shape manipulation.

Neural Networks

Complete layer reference, custom models with defmodel, summaries, and state-dict checkpointing.

Optimizers

SGD, Adam, AdamW, RMSprop, and Adagrad with learning-rate scheduling.

Distributed Training

Launch NCCL worker processes, wrap models in DDP, use AMP and gradient accumulation, and write rank-zero checkpoints.

Memory Management

Understand native allocation scopes, with-torch, retain!, release!, and how to avoid memory leaks in long REPL sessions.

Examples

Browse the full example directory: PyTorch basics, autograd tutorial, synthetic training, modern Llama, NanoChat, and distributed CUDA training.