TorchLean API

NN.Examples.Quickstart.AutogradBasics

Quickstart: Autograd #

Use autograd.grad for scalar tensor functions and autograd.model.grad when model state is also being differentiated. Add value := true when the scalar value is needed with the gradient.

Jacobians, Hessians, JVPs, VJPs, and gradient stopping live in NN.Examples.DeepDives.AutogradTransforms.

Run:

scripts/lake.sh exe torchlean quickstart_autograd

Subcommand name, kept in one place so the usage text and the error messages agree.

Instances For

    Mean squared magnitude of one tensor.

    Instances For

      A single affine model, y = W x + b.

      Instances For

        Run the two common differentiation paths.

        Instances For

          Help text; this demo takes no flags of its own.

          Instances For

            Entry point. CLI.dropDashDash lets the runner pass -- through, and requireNoArgs rejects stray flags rather than silently ignoring them.

            Instances For