Class WeightInitUtil


  • public class WeightInitUtil
    extends Object
    Weight initialization utility
    Author:
    Adam Gibson
    • Field Detail

      • DEFAULT_WEIGHT_INIT_ORDER

        public static final char DEFAULT_WEIGHT_INIT_ORDER
        Default order for the arrays created by WeightInitUtil.
        See Also:
        Constant Field Values
    • Method Detail

      • initWeights

        @Deprecated
        public static INDArray initWeights​(double fanIn,
                                           double fanOut,
                                           int[] shape,
                                           WeightInit initScheme,
                                           Distribution dist,
                                           INDArray paramView)
        Deprecated.
        Initializes a matrix with the given weight initialization scheme. Note: Defaults to fortran ('f') order arrays for the weights. Use #initWeights(int[], WeightInit, Distribution, char, INDArray) to control this
        Parameters:
        shape - the shape of the matrix
        initScheme - the scheme to use
        Returns:
        a matrix of the specified dimensions with the specified distribution based on the initialization scheme
      • initWeights

        public static INDArray initWeights​(double fanIn,
                                           double fanOut,
                                           long[] shape,
                                           WeightInit initScheme,
                                           Distribution dist,
                                           INDArray paramView)
        Initializes a matrix with the given weight initialization scheme. Note: Defaults to fortran ('f') order arrays for the weights. Use #initWeights(long[], WeightInit, Distribution, char, INDArray) to control this
        Parameters:
        shape - the shape of the matrix
        initScheme - the scheme to use
        Returns:
        a matrix of the specified dimensions with the specified distribution based on the initialization scheme
      • reshapeWeights

        public static INDArray reshapeWeights​(int[] shape,
                                              INDArray paramsView)
        Reshape the parameters view, without modifying the paramsView array values.
        Parameters:
        shape - Shape to reshape
        paramsView - Parameters array view
      • reshapeWeights

        public static INDArray reshapeWeights​(long[] shape,
                                              INDArray paramsView)
        Reshape the parameters view, without modifying the paramsView array values.
        Parameters:
        shape - Shape to reshape
        paramsView - Parameters array view
      • reshapeWeights

        public static INDArray reshapeWeights​(int[] shape,
                                              INDArray paramsView,
                                              char flatteningOrder)
        Reshape the parameters view, without modifying the paramsView array values.
        Parameters:
        shape - Shape to reshape
        paramsView - Parameters array view
        flatteningOrder - Order in which parameters are flattened/reshaped
      • reshapeWeights

        public static INDArray reshapeWeights​(long[] shape,
                                              INDArray paramsView,
                                              char flatteningOrder)
        Reshape the parameters view, without modifying the paramsView array values.
        Parameters:
        shape - Shape to reshape
        paramsView - Parameters array view
        flatteningOrder - Order in which parameters are flattened/reshaped