두 개 이상의 다른 레이어를 순차적으로 구성하는 레이어입니다.
예:
- MNIST를 위한 간단한 2계층 퍼셉트론 모델을 구축합니다.
let inputSize = 28 * 28
let hiddenSize = 300
var classifier = Sequential {
Dense<Float>(inputSize: inputSize, outputSize: hiddenSize, activation: relu)
Dense<Float>(inputSize: hiddenSize, outputSize: 3, activation: identity)
}
- MNIST용 자동 인코더를 빌드합니다.
var autoencoder = Sequential {
// The encoder.
Dense<Float>(inputSize: 28 * 28, outputSize: 128, activation: relu)
Dense<Float>(inputSize: 128, outputSize: 64, activation: relu)
Dense<Float>(inputSize: 64, outputSize: 12, activation: relu)
Dense<Float>(inputSize: 12, outputSize: 3, activation: relu)
// The decoder.
Dense<Float>(inputSize: 3, outputSize: 12, activation: relu)
Dense<Float>(inputSize: 12, outputSize: 64, activation: relu)
Dense<Float>(inputSize: 64, outputSize: 128, activation: relu)
Dense<Float>(inputSize: 128, outputSize: imageHeight * imageWidth, activation: tanh)
}
선언
public var layer1: Layer1
선언
public var layer2: Layer2
선언
public init(_ layer1: Layer1, _ layer2: Layer2)
선언
@differentiable(wrt: self) public func callAsFunction(_ input: Layer1.Input) -> Layer2.Output
선언
public init(@LayerBuilder layers: () -> `Self`)
선언
@differentiable public func callAsFunction(_ input: Layer1.Input) -> Layer2.Output