SGD

public struct SGD<Layer> : Optimizer where Layer : LayerType
extension SGD: Codable where Layer: Codable

‘Vanilla’ stochastic gradient descent optimizer

  • Undocumented

    Declaration

    Swift

    public typealias ParamTensor = Tensor<Layer.Parameter, Layer.Device>
  • Declaration

    Swift

    public private(set) var model: Layer { get }
  • Undocumented

    Declaration

    Swift

    public var learningRate: ParamTensor
  • ‘Vanilla’ stochastic gradient descent optimizer

    Declaration

    Swift

    public init(model: Layer, learningRate: ParamTensor)

    Parameters

    model

    Model to optimize

    learningRate

    Learning rate with which to move along the gradient

  • Declaration

    Swift

    public mutating func update(along gradients: [ParamTensor])

Available where Layer: Codable

  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws