TorchLean API

NN.API.Public.Facade.Runtime.Autograd

TorchLean Runtime Autograd #

Public autograd APIs for model- and function-level differentiation.

def TorchLean.autograd.model.linearParams {α : Type} {inDim outDim seedW seedB : } (w : Tensor.T α (Shape.mat outDim inDim)) (b : Tensor.T α (Shape.vec outDim)) :
Params (NN.API.nn.pure.linear inDim outDim seedW seedB) α

Pack explicit weight and bias tensors for the public nn.linear constructor.

This is the parameter-side companion to nn.linear inDim outDim seedW seedB.

Instances For
    def TorchLean.autograd.model.pack1 {α : Type} {s₁ : Shape} :
    Tensor.T α s₁nn.ParamTensors α [s₁]

    Pack one tensor into the typed parameter/result container used by the public autograd APIs.

    Instances For
      def TorchLean.autograd.model.pack2 {α : Type} {s₁ s₂ : Shape} (x₁ : Tensor.T α s₁) (x₂ : Tensor.T α s₂) :
      nn.ParamTensors α [s₁, s₂]

      Pack two tensors into the typed parameter/result container used by the public autograd APIs.

      Instances For
        def TorchLean.autograd.model.pack3 {α : Type} {s₁ s₂ s₃ : Shape} (x₁ : Tensor.T α s₁) (x₂ : Tensor.T α s₂) (x₃ : Tensor.T α s₃) :
        nn.ParamTensors α [s₁, s₂, s₃]

        Pack three tensors into the typed parameter/result container used by the public autograd APIs.

        Instances For
          def TorchLean.autograd.model.pack4 {α : Type} {s₁ s₂ s₃ s₄ : Shape} (x₁ : Tensor.T α s₁) (x₂ : Tensor.T α s₂) (x₃ : Tensor.T α s₃) (x₄ : Tensor.T α s₄) :
          nn.ParamTensors α [s₁, s₂, s₃, s₄]

          Pack four tensors into the typed parameter/result container used by the public autograd APIs.

          Instances For
            def TorchLean.autograd.model.unpack1 {α : Type} {s₁ : Shape} (xs : nn.ParamTensors α [s₁]) :
            Tensor.T α s₁

            Unpack a one-entry typed autograd parameter/result container.

            Instances For
              def TorchLean.autograd.model.unpack2 {α : Type} {s₁ s₂ : Shape} (xs : nn.ParamTensors α [s₁, s₂]) :
              Tensor.T α s₁ × Tensor.T α s₂

              Unpack a two-entry typed autograd parameter/result container.

              Instances For
                def TorchLean.autograd.model.unpack3 {α : Type} {s₁ s₂ s₃ : Shape} (xs : nn.ParamTensors α [s₁, s₂, s₃]) :
                Tensor.T α s₁ × Tensor.T α s₂ × Tensor.T α s₃

                Unpack a three-entry typed autograd parameter/result container.

                Instances For
                  def TorchLean.autograd.model.unpack4 {α : Type} {s₁ s₂ s₃ s₄ : Shape} (xs : nn.ParamTensors α [s₁, s₂, s₃, s₄]) :
                  Tensor.T α s₁ × Tensor.T α s₂ × Tensor.T α s₃ × Tensor.T α s₄

                  Unpack a four-entry typed autograd parameter/result container.

                  Instances For