TorchLean API

NN.API.Public.Facade.Data.Sample

TorchLean Public Samples #

Public sample types and constructors for supervised datasets.

@[reducible, inline]

A supervised sample (x, y) with input shape σ and target shape τ.

Instances For
    @[reducible, inline]
    abbrev TorchLean.Sample.Batch (α : Type) (n : ) (σ τ : Spec.Shape) :

    A fixed-size minibatch of supervised samples.

    Instances For
      def TorchLean.Sample.mk {α : Type} {σ τ : Shape} (x : Tensor.T α σ) (y : Tensor.T α τ) :
      Supervised α σ τ

      Build a supervised sample (x, y).

      Instances For
        def TorchLean.Sample.batch {α : Type} {n : } {σ τ : Shape} (x : Tensor.T α (Spec.Shape.dim n σ)) (y : Tensor.T α (Spec.Shape.dim n τ)) :
        Batch α n σ τ

        Build a batched supervised sample (xBatch, yBatch).

        Instances For
          def TorchLean.Sample.x {α : Type} {σ τ : Shape} (s : Supervised α σ τ) :
          Tensor.T α σ

          Extract the input tensor x from a supervised sample.

          Instances For
            def TorchLean.Sample.y {α : Type} {σ τ : Shape} (s : Supervised α σ τ) :
            Tensor.T α τ

            Extract the target tensor y from a supervised sample.

            Instances For
              def TorchLean.Sample.toPair {α : Type} {σ τ : Shape} (s : Supervised α σ τ) :
              Tensor.T α σ × Tensor.T α τ

              Unpack a supervised sample as the ordinary pair (x, y).

              Instances For
                def TorchLean.Sample.mapX {α : Type} {σ τ : Shape} (f : Tensor.T α σTensor.T α σ) (s : Supervised α σ τ) :
                Supervised α σ τ

                Map a function over the input tensor x, leaving the target y unchanged.

                Instances For
                  def TorchLean.Sample.mapY {α : Type} {σ τ : Shape} (f : Tensor.T α τTensor.T α τ) (s : Supervised α σ τ) :
                  Supervised α σ τ

                  Map a function over the target tensor y, leaving the input x unchanged.

                  Instances For
                    def TorchLean.Sample.mapXY {α : Type} {σ τ : Shape} (fx : Tensor.T α σTensor.T α σ) (fy : Tensor.T α τTensor.T α τ) (s : Supervised α σ τ) :
                    Supervised α σ τ

                    Map functions over both x and y in a supervised sample.

                    Instances For
                      def TorchLean.Sample.repeatBatch {α : Type} {σ τ : Shape} (batch : ) (s : Supervised α σ τ) :
                      Supervised α (Spec.Shape.dim batch σ) (Spec.Shape.dim batch τ)

                      Repeat one supervised sample across a fixed batch axis.

                      Use this for examples that naturally produce one (x, y) pair but need a model whose input/output shapes already include a batch dimension.

                      Instances For

                        A length-1 tensor, casting host Float into the selected runtime scalar.

                        Instances For

                          A length-2 tensor, casting host Float coordinates into the selected runtime scalar.

                          Instances For