Class ReshapePreprocessor

    • Constructor Detail

      • ReshapePreprocessor

        public ReshapePreprocessor​(long[] inputShape,
                                   long[] targetShape,
                                   boolean hasMiniBatchDimension)
        Parameters:
        inputShape - Input shape, with or without leading minibatch dimension, depending on value of hasMiniBatchDimension
        targetShape - Target shape, with or without leading minibatch dimension, depending on value of hasMiniBatchDimension
        hasMiniBatchDimension - If true: shapes should be of the form [minibatch, x, y, ...]; if false: shapes should be of form [x, y, ...]
      • ReshapePreprocessor

        public ReshapePreprocessor​(long[] inputShape,
                                   long[] targetShape,
                                   boolean hasMiniBatchDimension,
                                   DataFormat dataFormat)
        Parameters:
        inputShape - Input shape, with or without leading minibatch dimension, depending on value of hasMiniBatchDimension
        targetShape - Target shape, with or without leading minibatch dimension, depending on value of hasMiniBatchDimension
        hasMiniBatchDimension - If true: shapes should be of the form [minibatch, x, y, ...]; if false: shapes should be of form [x, y, ...]
        dataFormat - May be null. If non-null:
    • Method Detail

      • preProcess

        public INDArray preProcess​(INDArray input,
                                   int miniBatchSize,
                                   LayerWorkspaceMgr workspaceMgr)
        Description copied from interface: InputPreProcessor
        Pre preProcess input/activations for a multi layer network
        Parameters:
        input - the input to pre preProcess
        miniBatchSize - Minibatch size
        workspaceMgr - Workspace manager
        Returns:
        the processed input. Note that the returned array should be placed in the ArrayType.ACTIVATIONS workspace via the workspace manager
      • backprop

        public INDArray backprop​(INDArray output,
                                 int miniBatchSize,
                                 LayerWorkspaceMgr workspaceMgr)
        Description copied from interface: InputPreProcessor
        Reverse the preProcess during backprop. Process Gradient/epsilons before passing them to the layer below.
        Parameters:
        output - which is a pair of the gradient and epsilon
        miniBatchSize - Minibatch size
        workspaceMgr - Workspace manager
        Returns:
        the reverse of the pre preProcess step (if any). Note that the returned array should be placed in ArrayType.ACTIVATION_GRAD workspace via the workspace manager