DataSymbol

public protocol DataSymbol: GraphSymbol

Undocumented

  • Data source

    Declaration

    Swift

    var dataSource: SymbolDataSource
  • Indicate if grads of this data symbol should be used to update itself.

    updatable of DataSymbol V.S. enabledParameterUpdate of OperatorSymbol

    Both attribute controls data updating in backward training. updatable of a data symbol controls whether updating this symbol’s binded data, while enabledParameterUpdate controls whether updating operator symbol’s inbounds data symbols. If enabledParameterUpdate is false, Serrano will ignore updatable attributes of all data symbols in this operator symbol’s inbounds. So user can think enabledParameterUpdate has high priority over updatable on controlling.

    Declaration

    Swift

    var updatable: Bool
  • This attribute hold the grad of this data symbol in this epoch training. This grad value is chained value (i.e. grad of final output of the grpah against this data)

    Note

    currentGrad will be added to historyGrads at the end of each backward training.

    Declaration

    Swift

    var currentGrad: DataSymbolSupportedDataType?
  • Binded data

    Declaration

    Swift

    var bindedData: DataSymbolSupportedDataType?
  • Bind data to data symbol

    Declaration

    Swift

    func bindData(_ data:DataSymbolSupportedDataType) -> Bool

    Parameters

    data

    data to bind

    Return Value

    if binded successfully

  • backwardUpdate(_:gradValue:upGrads:) Default implementation

    This function used to update a data symbol’s value and grad during backward.

    Default Implementation

    This function used to update a data symbol’s value during backward.

    1. Calculate chained grads
    2. Use optimizer updaing bined value
    3. Store this epoch’s grad

    Declaration

    Swift

    mutating func backwardUpdate(_ optimizer: Optimizer, gradValue: DataSymbolSupportedDataType, upGrads:[DataSymbolSupportedDataType])

    Parameters

    optimizer

    optimizer

    gradValue

    this epoch calculated value

    upGrads

    up grads from backward chain