-
Operator label. Conforms to
ComputableOperator
Declaration
Swift
public var operatorLabel: String
-
This operator does not operator on GPU. Conforms to
ComputableOperator
Declaration
Swift
public var metalKernelFuncLabel = ""
-
Conforms to
ComputableOperator
Declaration
Swift
public var computationDelegate: OperatorCalculationDelegate?
-
Conforms to
ComputableOperator
Declaration
Swift
public var inputTensors: [Tensor]?
-
Declaration
Swift
public var outputTensors: [Tensor]?
-
If
true
, operator will not check theupGrads
‘s shape. This is used inside framework to speed up in situation we know it will not be wrong. Cases like auto generated differentiation graph.Declaration
Swift
public var disableUpGradShapeCheck: Bool = false
-
If
true
, operator will not callinputOutputTensorsCheck()
before doing calculation. This is used inside framework to speed up in situation we know it will not be wrong.Declaration
Swift
public var disableInputOutputCheck: Bool = false
-
Indicate if this operator would do paramter update.
Note
CopyOperator
is not trainable.Declaration
Swift
public var trainable: Bool = false
-
The mapping type of this operator.
OneToOne
for this operator.Declaration
Swift
public var mapType: OperatorMappingType
-
Copy operator cannot do in-place calculation
Declaration
Swift
public var inPlaceble: Bool = false
-
Designated init function
Declaration
Swift
public init(operatorLabel label: String, computationDelegate delegate: OperatorCalculationDelegate?, inputTensors: [Tensor]?, outputTensors: [Tensor]?)
Parameters
label
label description
delegate
delegate description
-
Convenience init function
Declaration
Swift
public convenience init(operatorLabel label: String = "CopyOperator")
Parameters
label
label description
-
Undocumented
Declaration
Swift
public convenience init(inputTensors tensors: [Tensor])
-
Undocumented
Declaration
Swift
public convenience init(inputTensors tensors: [Tensor], outputTensors: [Tensor])
-
For any input shapes, the output tensor’s shapes will be exactly the same
Declaration
Swift
public func outputShape(shapeArray shapes: [TensorShape]) -> [TensorShape]?
Parameters
shapes
shapes description
Return Value
return value description
-
The
inputTensors
should not benil
.Declaration
Swift
public func inputOutputTensorsCheck() -> (check: Bool, msg: String)
-
Compute sync
Note
This operator always runs on CPU.
Declaration
Swift
public func compute(_ computationMode: OperatorComputationMode = SerranoEngine.configuredEngine.defaultComputationMode)
Parameters
tensors
tensors description
computationMode
computationMode description. Will be ignored.
Return Value
return value description
-
Compute Async
Declaration
Swift
public func computeAsync(_ computationMode: OperatorComputationMode = SerranoEngine.configuredEngine.defaultComputationMode)
Parameters
tensors
tensors description
computationMode
computationMode description
-
Calulate grads sync. The gradient of copy is
1
.Declaration
Swift
public func gradCompute(_ computationMode: OperatorComputationMode) -> [String: DataSymbolSupportedDataType]
Parameters
computationMode
computationMode
Return Value
return
upGrads
if not nil. Else return an empty array. -
Cal grads async
Declaration
Swift
public func gradComputAsync(_ computationMode: OperatorComputationMode)
Parameters
computationMode
computationMode
upGrds
upGrds
-
No updatable parameters. This function just returns.
Declaration
Swift
public func updateParams(grads: [Tensor], LR: Float)
Parameters
grads
grads
LR
LR
-
This operator has no parameters. Do nothing
Declaration
Swift
public func bindParamSymbols(_ symbols: [GraphSymbol])
-
This operator has no parameters.
Declaration
Swift
public func paramSymbols() -> [GraphSymbol]
Return Value
An empty array