public protocol Differentiable

A type that mathematically represents a differentiable manifold whose tangent spaces are finite-dimensional.

  • The tangent bundle of this differentiable manifold.

    Declaration

    associatedtype TangentVector
  • The cotangent bundle of this differentiable manifold.

    Declaration

    associatedtype CotangentVector
  • The type of all differentiable variables in this type.

    Declaration

    associatedtype AllDifferentiableVariables
  • allDifferentiableVariables

    Default implementation

    All differentiable variables in this value.

    Default Implementation

    Declaration

    var allDifferentiableVariables: AllDifferentiableVariables { get }
  • moved(along:)

    Default implementation

    Returns self moved along the value space towards the given tangent vector. In Riemannian geometry (mathematics), this represents an exponential map.

    Default Implementation

    Declaration

    func moved(along direction: TangentVector) -> Self
  • Convert a cotangent vector to its corresponding tangent vector.

    Declaration

    func tangentVector(from cotangent: CotangentVector) -> TangentVector
  • withoutDerivative()

    Extension method

    Identity function that stops gradients from propagating.

    Declaration

    @_semantics("autodiff.nonvarying")
    func withoutDerivative() -> Self
  • Declaration

    func withRecomputationInPullbacks<Result : Differentiable>(
      _ body: @escaping @differentiable (Self) -> Result
    ) -> Result
  • sequenced(through:_:)

    Extension method

    Returns the output computed by applying a sequence of layers to the previous layer’s output, except that the first layer’s input is self.

    Declaration

    func sequenced<L1: Layer, L2: Layer>(through l1: L1, _ l2: L2) -> L2.Output
        where L1.Input == Self, L1.Output == L2.Input

    Parameters

    l1

    The first layer.

    l2

    The second layer.

    Return Value

    The final layer’s output after sequential application.

  • sequenced(through:_:_:)

    Extension method

    Returns the output computed by applying a sequence of layers to the previous layer’s output, except that the first layer’s input is self.

    Declaration

    func sequenced<L1: Layer, L2: Layer, L3: Layer>(through l1: L1, _ l2: L2, _ l3: L3) -> L3.Output
        where L1.Input == Self, L1.Output == L2.Input, L2.Output == L3.Input

    Parameters

    l1

    The first layer.

    l2

    The second layer.

    l3

    The third layer.

    Return Value

    The final layer’s output after sequential application.

  • sequenced(through:_:_:_:)

    Extension method

    Returns the output computed by applying a sequence of layers to the previous layer’s output, except that the first layer’s input is self.

    Declaration

    func sequenced<L1: Layer, L2: Layer, L3: Layer, L4: Layer>(
        through l1: L1, _ l2: L2, _ l3: L3, _ l4: L4
    ) -> L4.Output
        where L1.Input == Self, L1.Output == L2.Input, L2.Output == L3.Input,
              L3.Output == L4.Input

    Parameters

    l1

    The first layer.

    l2

    The second layer.

    l3

    The third layer.

    l4

    The fourth layer.

    Return Value

    The final layer’s output after sequential application.

  • sequenced(through:_:_:_:_:)

    Extension method

    Returns the output computed by applying a sequence of layers to the previous layer’s output, except that the first layer’s input is self.

    Declaration

    func sequenced<L1: Layer, L2: Layer, L3: Layer, L4: Layer, L5: Layer>(
        through l1: L1, _ l2: L2, _ l3: L3, _ l4: L4, _ l5: L5
    ) -> L5.Output
        where L1.Input == Self, L1.Output == L2.Input, L2.Output == L3.Input, L3.Output == L4.Input,
              L4.Output == L5.Input

    Parameters

    l1

    The first layer.

    l2

    The second layer.

    l3

    The third layer.

    l4

    The third layer.

    l5

    The fifth layer.

    Return Value

    The final layer’s output after sequential application.

  • Returns the output computed by applying a sequence of layers to the previous layer’s output, except that the first layer’s input is self.

    Declaration

    func sequenced<L1: Layer, L2: Layer, L3: Layer, L4: Layer, L5: Layer, L6: Layer>(
        through l1: L1, _ l2: L2, _ l3: L3, _ l4: L4, _ l5: L5, _ l6: L6
    ) -> L6.Output
        where L1.Input == Self, L1.Output == L2.Input, L2.Output == L3.Input, L3.Output == L4.Input,
              L4.Output == L5.Input, L5.Output == L6.Input

    Parameters

    l1

    The first layer.

    l2

    The second layer.

    l3

    The third layer.

    l4

    The third layer.

    l5

    The fifth layer.

    l6

    The sixth layer.

    Return Value

    The final layer’s output after sequential application.