BatchNormOperator
public class BatchNormOperator: ComputableOperator
Batch normalization operator.
Normalize on input tensors by each tensor’s mean and variance.
All input tensors should have same dimentsion.
output tensors should have same channel order as input
Currently, only support 2D tensor with channel information.
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Declaration
Swift
public var computationDelegate: OperatorCalculationDelegate?
-
Declaration
Swift
public var metalKernelFuncLabel: String
-
Declaration
Swift
public var operatorLabel: String
-
Declaration
Swift
public var inputTensors: [Tensor]?
-
Declaration
Swift
public var outputTensors: [Tensor]?
-
Declaration
Swift
public var disableInputOutputCheck: Bool
-
Declaration
Swift
public var trainable: Bool
-
Declaration
Swift
public var mapType: OperatorMappingType
-
Declaration
Swift
public var inPlaceble: Bool = true
-
Channel order of input
Declaration
Swift
public var channelOrder: TensorChannelOrder
-
Moving mean. Should be same dimension with feature axis.
Declaration
Swift
public var movingMean: Tensor?
-
Moving varience Should be same dimension with feature axis.
Declaration
Swift
public var movingVar: Tensor?
-
A small float number to avoid dividing by 0. default is
0.001
Declaration
Swift
public var epsilon: Float
-
If use scale tensor
Declaration
Swift
public var useScale: Bool
-
Scale tensor to output. Should be same dimension with feature axis.
Declaration
Swift
public var scale: Tensor?
-
If use offset tensor
Declaration
Swift
public var useOffset: Bool
-
offset tensor to output. Should be same dimension with feature axis.
Declaration
Swift
public var offset: Tensor?
-
Input shape. Should not be
nil
if used in Graph API.Declaration
Swift
public var inputShape: TensorShape?
-
If in training or not.
Declaration
Swift
public var inTraining: Bool
-
init(channelOrder:movingMean:movingVar:useScale:scale:useOffset:offset:epsilon:metalKernelFuncLabel:operatorLabel:inputTensors:outputTensors:disableInputOutputCheck:trainable:mapType:inputShape:inTraining:)
Undocumented
Declaration
Swift
public init(channelOrder: TensorChannelOrder = TensorChannelOrder.Last, movingMean: Tensor? = nil, movingVar: Tensor? = nil, useScale: Bool = true, scale: Tensor? = nil, useOffset: Bool = true, offset: Tensor? = nil, epsilon: Float = 0.001, metalKernelFuncLabel: String = "", operatorLabel: String = "BatchNormalizationOperator", inputTensors: [Tensor]? = nil, outputTensors: [Tensor]? = nil, disableInputOutputCheck: Bool = false, trainable: Bool = false, mapType: OperatorMappingType = OperatorMappingType.OneToOne, inputShape: TensorShape? = nil, inTraining: Bool = false)
-
Outputshape are same as input shapes.
Note
All input shapes should have same dimension
Declaration
Swift
public func outputShape(shapeArray shapes: [TensorShape]) -> [TensorShape]?
Parameters
shapes
Return Value
-
Declaration
Swift
public func inputOutputTensorsCheck() -> (check: Bool, msg: String)
-
Declaration
Swift
public func compute(_ computationMode: OperatorComputationMode)
-
Declaration
Swift
public func computeAsync(_ computationMode: OperatorComputationMode)
-
Undocumented
Declaration
Swift
internal func cpu()
-
Undocumented
Declaration
Swift
internal func gpu()
-
CPU in training
Declaration
Swift
internal func cpu_train()
-
GPU in training
Declaration
Swift
internal func gpu_train()
-
CPU in inference
Declaration
Swift
internal func cpu_inference()
-
GPU in inference
Declaration
Swift
internal func gpu_inference()
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Declaration
Swift
public func gradCompute(_ computationMode: OperatorComputationMode) -> [String : DataSymbolSupportedDataType]
-
Declaration
Swift
public func gradComputAsync(_ computationMode: OperatorComputationMode)
-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Declaration
Swift
public func bindParamSymbols(_ symbols: [GraphSymbol])
-
Declaration
Swift
public func paramSymbols() -> [GraphSymbol]