TorchLean API

NN.API.Sample

Supervised Samples #

Typed input-target records used by datasets and trainers.

Application code works with the named input and target fields. The runtime conversion to its heterogeneous graph-argument representation is confined to Sample.Internal.

structure TorchLean.Sample.Supervised (α : Type) [Storage α] (σ τ : Shape) :

A supervised input-target sample with both shapes tracked statically.

  • input : Tensor α σ

    Model input.

  • target : Tensor α τ

    Expected model output.

Instances For
    def TorchLean.Sample.instReprSupervised.repr {α✝ : Type} {inst✝ : Storage α✝} {σ✝ τ✝ : Shape} [Repr α✝] :
    Supervised α✝ σ✝ τ✝Std.Format
    Instances For
      @[instance_reducible]
      instance TorchLean.Sample.instReprSupervised {α✝ : Type} {inst✝ : Storage α✝} {σ✝ τ✝ : Shape} [Repr α✝] :
      Repr (Supervised α✝ σ✝ τ✝)
      @[reducible, inline]
      abbrev TorchLean.Sample.Batch (α : Type) [Storage α] (n : ) (σ τ : Shape) :

      A fixed-size minibatch whose tensors share the leading dimension n.

      Instances For
        def TorchLean.Sample.mapInput {α : Type} [Storage α] {σ σ' τ : Shape} (f : Tensor α σTensor α σ') (sample : Supervised α σ τ) :
        Supervised α σ' τ

        Map the input tensor, optionally changing its shape.

        Instances For
          def TorchLean.Sample.mapTarget {α : Type} [Storage α] {σ τ τ' : Shape} (f : Tensor α τTensor α τ') (sample : Supervised α σ τ) :
          Supervised α σ τ'

          Map the target tensor, optionally changing its shape.

          Instances For
            def TorchLean.Sample.map {α β : Type} [Storage α] [Storage β] {σ τ σ' τ' : Shape} (mapInput : Tensor α σTensor β σ') (mapTarget : Tensor α τTensor β τ') (sample : Supervised α σ τ) :
            Supervised β σ' τ'

            Map both tensors, optionally changing their element type and shapes.

            Instances For
              def TorchLean.Sample.Internal.arguments {α : Type} [Storage α] {σ τ : Shape} (sample : Supervised α σ τ) :
              Arguments α [σ, τ]

              Convert a supervised record to the generic argument representation used by graph runtimes.

              Instances For