public protocol Layer : Module where Self.Input : Differentiable

신경망 계층.

준수 유형 Layer 출력으로지도 입력하는 기능을 나타냅니다. 가중치 텐서와 같은 매개변수로 표현되는 내부 상태를 가질 수 있습니다.

Layer 인스턴스는 미분 정의 callAsFunction(_:) 출력에 매핑 입력을위한 방법.

  • 주어진 입력에 레이어를 적용하여 얻은 출력을 반환합니다.

    선언

    @differentiable
    func callAsFunction(_ input: Input) -> Output

    매개변수

    input

    레이어에 대한 입력입니다.

    반환 값

    출력.

  • 앞으로(_:)

    기본 구현

    기본 구현

    선언

    @differentiable
    func forward(_ input: Input) -> Output
  • 추론하다(from:)

    확장 방법

    주어진 입력에 레이어를 적용하여 얻은 추론 출력을 반환합니다.

    선언

    public func inferring(from input: Input) -> Output

    매개변수

    input

    레이어에 대한 입력입니다.

    반환 값

    추론 출력.

  • 역전파자

    확장 방법

    선언

    public typealias Backpropagator = (_ direction: Output.TangentVector)
      -> (layerGradient: TangentVector, inputGradient: Input.TangentVector)
  • 주어진 입력에 레이어를 적용하여 얻은 추론 출력과 역전파 함수를 반환합니다.

    선언

    public func appliedForBackpropagation(to input: Input)
      -> (output: Output, backpropagator: Backpropagator)

    매개변수

    input

    레이어에 대한 입력입니다.

    반환 값

    출력과 역전파 함수를 포함하는 튜플. backpropagation 함수(backpropagator라고도 함)는 방향 벡터를 사용하여 레이어와 입력에서 각각 그라디언트를 반환합니다.

`Input`: `DifferentiableTensorProtocol`, `Output`: `DifferentiableTensorProtocol`에서 사용 가능

  • callAsFunction(_:)

    기본 구현

    기본 구현

    선언

    @differentiable(wrt: self)
    @differentiable
    public func callAsFunction(_ input: Input) -> Output