org.apache.sysds.runtime.matrix.data

## 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 and Description
    --- | ---
    `static class` | `LibMatrixDNN.PoolingType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LibMatrixDNN()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and 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 function
    `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
    `static void` | `channelSums(MatrixBlock input, MatrixBlock outputBlock, int C, int HW)` Perform channel sum operation
    `static 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 operation
    `static void` | `conv2dBackwardFilter(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, DnnParameters params)` This method computes the backpropogation errors for filter of convolution operation
    `static 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 operation
    `static void` | `reluBackward(MatrixBlock input, MatrixBlock dout, MatrixBlock outputBlock, int numThreads)` This method computes the backpropagation errors for previous layer of relu operation
    `static void` | `resetStatistics()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LibMatrixDNN

          public LibMatrixDNN()

  - ### Method Detail

    - #### resetStatistics

          public static void resetStatistics()

    - #### 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 batch
        `filter` - filter
        `outputBlock` - output of convolution
        `params` - 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 conv2d
        `dout` - errors from next layer
        `outputBlock` - output errors
        `params` - 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 image
        `dout` - errors from next layer
        `outputBlock` - output errors
        `params` - 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 matrix
        `dout` - dout matrix
        `outputBlock` - output matrix
        `params` - convolution parameters
        `performReluBackward` - perform ReLU backward
        `poolType` - 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 matrix
        `dout` - errors from next layer
        `outputBlock` - output matrix
        `numThreads` - 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 matrix
        `bias` - bias matrix
        `outputBlock` - output matrix
        `numThreads` - number of threads

    - #### channelSums

          public static void channelSums(MatrixBlock input,
                                         MatrixBlock outputBlock,
                                         int C,
                                         int HW)

      Perform channel sum operation
      Parameters:
        `input` - input matrix block
        `outputBlock` - output matrix block
        `C` - number of channels
        `HW` - 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 matrix
        `bias` - bias matrix
        `outputBlock` - output matrix
        `numThreads` - number of threads

Copyright © 2020 The Apache Software Foundation. All rights reserved.