TransposeOperator
public class TransposeOperator: ComputableOperator
Transpose 2D matrix on all inputTensors
and put transposed values in outputTensors
.
-
Conforms to
ComputableOperator
Declaration
Swift
public var computationDelegate: OperatorCalculationDelegate?
-
Conforms to
ComputableOperator
Declaration
Swift
public var metalKernelFuncLabel: String = "Transpose"
-
Conforms to
ComputableOperator
Declaration
Swift
public var operatorLabel: String
-
Conforms to
ComputableOperator
Declaration
Swift
public var inputTensors: [Tensor]?
-
Conforms to
ComputableOperator
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.
Declaration
Swift
public var trainable: Bool = false
-
The mapping type of this operator.
OneToOne
for this operator.Declaration
Swift
public var mapType: OperatorMappingType
-
Transpose operator cannot do in-place calculation
Declaration
Swift
public var inPlaceble: Bool = false
-
Undocumented
Declaration
Swift
public init(inputTensors: [Tensor]?, outputTensors: [Tensor]?, computationDelegate: OperatorCalculationDelegate?, operatorLabel: String)
-
Undocumented
Declaration
Swift
public convenience init(computationDelegate: OperatorCalculationDelegate?)
-
Undocumented
Declaration
Swift
public convenience init(label: String = "TransposeOp")
-
Undocumented
-
Only accepts 2D matrix.
Declaration
Swift
public func outputShape(shapeArray shapes: [TensorShape]) -> [TensorShape]?
Parameters
shapes
input shapes
Return Value
output shapes
-
Check if
inputTensors
andoutputTensors
have correct corresponding tensors.Declaration
Swift
public func inputOutputTensorsCheck() -> (check: Bool, msg: String)
Return Value
passing and message
-
Do calcualtion.
Declaration
Swift
public func compute(_ computationMode: OperatorComputationMode = SerranoEngine.configuredEngine.defaultComputationMode)
Parameters
computationMode
mode
-
Declaration
Swift
public func computeAsync(_ computationMode: OperatorComputationMode = SerranoEngine.configuredEngine.defaultComputationMode)
-
Calulate grads sync. All unary operator return grads tensor with same number and shape as attribute
inputTensors
.Declaration
Swift
public func gradCompute(_ computationMode: OperatorComputationMode) -> [String: DataSymbolSupportedDataType]
Parameters
computationMode
computationMode
upGrds
upGrds
Return Value
return grads tensor
-
Cal grads async
Declaration
Swift
public func gradComputAsync(_ computationMode: OperatorComputationMode)
Parameters
computationMode
computationMode
upGrds
upGrds
-
Update params if possible. No update parameters for binary operators.
Declaration
Swift
public func updateParams(grads: [Tensor], LR: Float)
Parameters
grads
grads tensor list
LR
learning rate
-
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
-
Undocumented
Declaration
Swift
internal func cpu()
-
Undocumented
Declaration
Swift
internal func gpu()