-
Input symbols for this operator
Note
symbols in this attribute should also be included ininBounds
Declaration
Swift
var inputSymbols: [TensorSymbol]
-
Input shapes tensor symbols in
inputSymbols
Declaration
Swift
var inputTensorShapes: [TensorShape]
-
Parameters (weights, bias etc.) symbols for this operator. For operator having no params, this should be an empty array.
Note
symbols in this attribute should also be included ininBounds
Declaration
Swift
var paramSymbols: [DataSymbol]
-
The operator instance
Declaration
Swift
var serranoOperator: ComputableOperator
-
Control if update asscoiated operator’s parameter
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 enabledParameterUpdate: Bool
-
Get output symbols of this operator
Declaration
Swift
func outputSymbols() -> [TensorSymbol]
Return Value
Array of SerranoTensorSymbol.
-
addToParamSymbols(_:)
Default implementationAdd to
paramSymbols
Default Implementation
Add to
paramSymbols
Declaration
Swift
func addToParamSymbols(_ symbol: GraphSymbol)
Parameters
symbol
new symbol
-
gradsOnInput(_:)
Default implementationGet grads on any inbounds symbol
Default Implementation
Get grads on any inbounds symbol. Call attached operator’s
gradCompute(_:, :)
to get grads. Use return tensor’s label to identify corresponding input datasymbol.Identify corresponding input
The tensor label of returned tensors could be used to identify its correspoding input following below rules:
- Input tensor.
input_{i}
wherei
is the corresponding input tensor’s index ininputTensors
Parameter. The parameter’s name.
Note
If
inputSymbol
does not belong to this operator symbol.fatalError()
raised.Declaration
Swift
func gradsOnInput(_ inputSymbol: DataSymbol) -> DataSymbolSupportedDataType
Parameters
inputSymbol
Return Value
SupportedGradsDataType
- Input tensor.
-
inboundSymbolForGradLabel(_:)
Default implementationGet corresponding inbound symbol for a label following rule in
Operator
methodgradCompute(_:)
.Default Implementation
Get inbound data symbol for target label.
Identify corresponding input
The returned label of data could be used to identify its correspoding input following below rules:
- Input tensor.
input_{i}
wherei
is the corresponding input tensor’s index ininputTensors
Parameter. The parameter’s name.
Note
may return
nil
Declaration
Swift
func inboundSymbolForGradLabel(_ label: String) -> DataSymbol?
Parameters
label
label
Return Value
DataSymbol
- Input tensor.
-
gradRelatedOutputSymbols(onInboundSymbol:)
Default implementationFor a given
symbol
in inbounds, return a list of output symbols that it involves with calculation.Default Implementation
For a given
symbol
in inbounds, return a list of output symbols that it involves with calculation.Declaration
Swift
func gradRelatedOutputSymbols(onInboundSymbol symbol: DataSymbol) -> [DataSymbol]
Parameters
symbol
target symbol
Return Value
list of output symbol
-
evaluate(_:)
Extension methodUndocumented
Declaration
Swift
public func evaluate(_ mode: OperatorComputationMode = .GPU) -> [DataSymbolSupportedDataType]?