SerranoScalarSymbol
public class SerranoScalarSymbol: SerranoGraphSymbol, ScalarSymbol
Implementation of ScalarSymbol
-
Binded scalar value
Declaration
Swift
public var bindedData: DataSymbolSupportedDataType?
-
The data type
Declaration
Swift
public var dataType: TensorDataType
-
Data source
Declaration
Swift
public var dataSource: SymbolDataSource
-
If differentiable
Declaration
Swift
public var updatable = false
-
Current grad
Declaration
Swift
public var currentGrad: DataSymbolSupportedDataType?
-
If enabled history grads recording. Default is
false
.Declaration
Swift
public var historyGradsEnabled = false
-
grads
Declaration
Swift
public var historyGrads: [DataSymbolSupportedDataType] = [SupportedScalarDataType]() as! [DataSymbolSupportedDataType]
-
Scalar value
Declaration
Swift
internal var _bindedData: SupportedScalarDataType?
-
Designated init
Declaration
Swift
public init(dataType: TensorDataType, dataSource: SymbolDataSource, bindedData: SupportedScalarDataType? = nil, label: String, inBounds: [GraphSymbol], outBounds: [GraphSymbol])
Parameters
dataType
dataType
dataSource
dataSource
bindedData
bindedData
label
label
inBounds
inBounds
outBounds
outBounds
-
Convenience init
Declaration
Swift
public convenience init(_ label: String = "Scalar Symbol", dataType: TensorDataType, dataSource: SymbolDataSource)
Parameters
dataType
dataType
-
Bind to a scalar variable
Note
If passed in
data
‘s type is uncompatible with attributedataType
, no further action will be taken. Since when doing calculation, all data converted toFloat
.Declaration
Swift
public func bindData(_ data:DataSymbolSupportedDataType) -> Bool
Parameters
data
data. Should be a scalar variable (
Int
, ‘Float’ orDouble
).Return Value
bind result