Class LibMatrixNative


  • public class LibMatrixNative
    extends Object
    • Constructor Detail

      • LibMatrixNative

        public LibMatrixNative()
    • Method Detail

      • isMatMultMemoryBound

        public static boolean isMatMultMemoryBound​(int m1Rlen,
                                                   int m1Clen,
                                                   int m2Clen)
      • matrixMult

        public static MatrixBlock matrixMult​(MatrixBlock m1,
                                             MatrixBlock m2,
                                             MatrixBlock ret,
                                             int k)
        Performs matrix multiplication using native library if BLAS is available or else falls back to Java BLAS.
        Parameters:
        m1 - lhs matrix block
        m2 - rhs matrix block
        ret - output matrix block
        k - number of threads
        Returns:
        the ret matrixBlock if allocated otherwise a new matrixBlock.
      • 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
      • 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
      • conv2dBackwardData

        public static void conv2dBackwardData​(MatrixBlock filter,
                                              MatrixBlock dout,
                                              MatrixBlock outputBlock,
                                              DnnParameters params)
        This method computes the backpropagation errors for previous layer of convolution operation
        Parameters:
        filter - filter used in conv2d
        dout - errors from next layer
        outputBlock - output errors
        params - convolution parameters
      • isSinglePrecision

        public static boolean isSinglePrecision()
      • fromFloatBuffer

        public static void fromFloatBuffer​(FloatBuffer buff,
                                           double[] output)