-
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, whileenabledParameterUpdate
controls whether updating operator symbol’s inbounds data symbols. IfenabledParameterUpdate
isfalse
, Serrano will ignoreupdatable
attributes of all data symbols in this operator symbol’s inbounds. So user can thinkenabledParameterUpdate
has high priority overupdatable
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 tohistoryGrads
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 implementationThis 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.
- Calculate chained grads
- Use optimizer updaing bined value
- 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