Class LibMatrixDNN
- java.lang.Object
-
- org.apache.sysds.runtime.matrix.data.LibMatrixDNN
-
public class LibMatrixDNN extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LibMatrixDNN.PoolingType
-
Constructor Summary
Constructors Constructor Description LibMatrixDNN()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addBias(double[] a, double[] bias, double biasMultiplier, int N, int K, int PQ)
static void
batchNorm2D(MatrixBlock image, MatrixBlock scale, MatrixBlock bias, MatrixBlock runningMean, MatrixBlock runningVar, String phase, double epsilon, double mu, MatrixBlock ret, MatrixBlock retRunningMean, MatrixBlock retRunningVar, MatrixBlock resultSaveMean, MatrixBlock resultSaveInvVariance)
static void
batchNorm2DBackward(MatrixBlock image, MatrixBlock dout, MatrixBlock scale, double epsilon, MatrixBlock resultSaveMean, MatrixBlock resultSaveInvVariance, MatrixBlock dX, MatrixBlock dScale, MatrixBlock dBias)
static void
biasAdd(MatrixBlock input, MatrixBlock bias, MatrixBlock outputBlock, int numThreads)
Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input + matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in functionstatic void
biasMultiply(MatrixBlock input, MatrixBlock bias, MatrixBlock outputBlock, int numThreads)
Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input * matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_multiply(input, bias) built-in functionstatic void
channelSums(MatrixBlock input, MatrixBlock outputBlock, int C, int HW)
Perform channel sum operationstatic void
conv2d(MatrixBlock input, MatrixBlock filter, MatrixBlock outputBlock, DnnParameters params)
This method performs convolution (i.e.static void
conv2dBackwardData(MatrixBlock filter, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropogation errors for previous layer of convolution operationstatic void
conv2dBackwardFilter(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropogation errors for filter of convolution operationstatic void
multBias(double[] a, double[] bias, int N, int K, int PQ)
static void
pooling(MatrixBlock input, MatrixBlock output, DnnParameters params, LibMatrixDNN.PoolingType poolType)
static void
poolingBackward(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params, boolean performReluBackward, LibMatrixDNN.PoolingType poolType)
This method computes the backpropogation errors for previous layer of pooling operationstatic void
reluBackward(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, int numThreads)
This method computes the backpropagation errors for previous layer of relu operation
-
-
-
Method Detail
-
conv2d
public static void conv2d(MatrixBlock input, MatrixBlock filter, MatrixBlock outputBlock, DnnParameters params)
This method performs convolution (i.e. cross-correlation) operation on input- Parameters:
input
- input batchfilter
- filteroutputBlock
- output of convolutionparams
- convolution parameters
-
conv2dBackwardData
public static void conv2dBackwardData(MatrixBlock filter, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropogation errors for previous layer of convolution operation- Parameters:
filter
- filter used in conv2ddout
- errors from next layeroutputBlock
- output errorsparams
- convolution parameters
-
conv2dBackwardFilter
public static void conv2dBackwardFilter(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)
This method computes the backpropogation errors for filter of convolution operation- Parameters:
input
- input imagedout
- errors from next layeroutputBlock
- output errorsparams
- convolution parameters
-
pooling
public static void pooling(MatrixBlock input, MatrixBlock output, DnnParameters params, LibMatrixDNN.PoolingType poolType)
-
poolingBackward
public static void poolingBackward(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params, boolean performReluBackward, LibMatrixDNN.PoolingType poolType)
This method computes the backpropogation errors for previous layer of pooling operation- Parameters:
input
- input matrixdout
- dout matrixoutputBlock
- output matrixparams
- convolution parametersperformReluBackward
- perform ReLU backwardpoolType
- type of pooling
-
reluBackward
public static void reluBackward(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, int numThreads)
This method computes the backpropagation errors for previous layer of relu operation- Parameters:
input
- input matrixdout
- errors from next layeroutputBlock
- output matrixnumThreads
- number of threads
-
biasAdd
public static void biasAdd(MatrixBlock input, MatrixBlock bias, MatrixBlock outputBlock, int numThreads)
Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input + matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_add(input, bias) built-in function- Parameters:
input
- input matrixbias
- bias matrixoutputBlock
- output matrixnumThreads
- number of threads
-
channelSums
public static void channelSums(MatrixBlock input, MatrixBlock outputBlock, int C, int HW)
Perform channel sum operation- Parameters:
input
- input matrix blockoutputBlock
- output matrix blockC
- number of channelsHW
- height X width
-
batchNorm2DBackward
public static void batchNorm2DBackward(MatrixBlock image, MatrixBlock dout, MatrixBlock scale, double epsilon, MatrixBlock resultSaveMean, MatrixBlock resultSaveInvVariance, MatrixBlock dX, MatrixBlock dScale, MatrixBlock dBias)
-
batchNorm2D
public static void batchNorm2D(MatrixBlock image, MatrixBlock scale, MatrixBlock bias, MatrixBlock runningMean, MatrixBlock runningVar, String phase, double epsilon, double mu, MatrixBlock ret, MatrixBlock retRunningMean, MatrixBlock retRunningVar, MatrixBlock resultSaveMean, MatrixBlock resultSaveInvVariance)
-
addBias
public static void addBias(double[] a, double[] bias, double biasMultiplier, int N, int K, int PQ)
-
multBias
public static void multBias(double[] a, double[] bias, int N, int K, int PQ)
-
biasMultiply
public static void biasMultiply(MatrixBlock input, MatrixBlock bias, MatrixBlock outputBlock, int numThreads)
Performs the operation corresponding to the DML script: ones = matrix(1, rows=1, cols=Hout*Wout) output = input * matrix(bias %*% ones, rows=1, cols=F*Hout*Wout) This operation is often followed by conv2d and hence we have introduced bias_multiply(input, bias) built-in function- Parameters:
input
- input matrixbias
- bias matrixoutputBlock
- output matrixnumThreads
- number of threads
-
-