Class FrozenLayer

    • Constructor Detail

      • FrozenLayer

        public FrozenLayer​(Layer insideLayer)
    • Method Detail

      • layerId

        protected String layerId()
      • calcRegularizationScore

        public double calcRegularizationScore​(boolean backpropParamsOnly)
        Description copied from interface: Layer
        Calculate the regularization component of the score, for the parameters in this layer
        For example, the L1, L2 and/or weight decay components of the loss function
        Specified by:
        calcRegularizationScore in interface Layer
        Overrides:
        calcRegularizationScore in class BaseWrapperLayer
        Parameters:
        backpropParamsOnly - If true: calculate regularization score based on backprop params only. If false: calculate based on all params (including pretrain params, if any)
        Returns:
        the regularization score of
      • backpropGradient

        public Pair<Gradient,​INDArray> backpropGradient​(INDArray epsilon,
                                                              LayerWorkspaceMgr workspaceMgr)
        Description copied from interface: Layer
        Calculate the gradient relative to the error in the next layer
        Specified by:
        backpropGradient in interface Layer
        Overrides:
        backpropGradient in class BaseWrapperLayer
        Parameters:
        epsilon - w^(L+1)*delta^(L+1). Or, equiv: dC/da, i.e., (dC/dz)*(dz/da) = dC/da, where C is cost function a=sigma(z) is activation.
        workspaceMgr - Workspace manager
        Returns:
        Pair where Gradient is gradient for this layer, INDArray is epsilon (activation gradient) needed by next layer, but before element-wise multiply by sigmaPrime(z). So for standard feed-forward layer, if this layer is L, then return.getSecond() == dL/dIn = (w^(L)*(delta^(L))^T)^T. Note that the returned array should be placed in the ArrayType.ACTIVATION_GRAD workspace via the workspace manager
      • activate

        public INDArray activate​(boolean training,
                                 LayerWorkspaceMgr workspaceMgr)
        Description copied from interface: Layer
        Perform forward pass and return the activations array with the last set input
        Specified by:
        activate in interface Layer
        Overrides:
        activate in class BaseWrapperLayer
        Parameters:
        training - training or test mode
        workspaceMgr - Workspace manager
        Returns:
        the activation (layer output) of the last specified input. Note that the returned array should be placed in the ArrayType.ACTIVATIONS workspace via the workspace manager
      • activate

        public INDArray activate​(INDArray input,
                                 boolean training,
                                 LayerWorkspaceMgr workspaceMgr)
        Description copied from interface: Layer
        Perform forward pass and return the activations array with the specified input
        Specified by:
        activate in interface Layer
        Overrides:
        activate in class BaseWrapperLayer
        Parameters:
        input - the input to use
        training - train or test mode
        workspaceMgr - Workspace manager.
        Returns:
        Activations array. Note that the returned array should be placed in the ArrayType.ACTIVATIONS workspace via the workspace manager
      • fit

        public void fit()
        Description copied from interface: Model
        All models have a fit method
        Specified by:
        fit in interface Model
        Overrides:
        fit in class BaseWrapperLayer
      • update

        public void update​(Gradient gradient)
        Description copied from interface: Model
        Update layer weights and biases with gradient change
        Specified by:
        update in interface Model
        Overrides:
        update in class BaseWrapperLayer
      • update

        public void update​(INDArray gradient,
                           String paramType)
        Description copied from interface: Model
        Perform one update applying the gradient
        Specified by:
        update in interface Model
        Overrides:
        update in class BaseWrapperLayer
        Parameters:
        gradient - the gradient to apply
      • setBackpropGradientsViewArray

        public void setBackpropGradientsViewArray​(INDArray gradients)
        Description copied from interface: Model
        Set the gradients array as a view of the full (backprop) network parameters NOTE: this is intended to be used internally in MultiLayerNetwork and ComputationGraph, not by users.
        Specified by:
        setBackpropGradientsViewArray in interface Model
        Overrides:
        setBackpropGradientsViewArray in class BaseWrapperLayer
        Parameters:
        gradients - a 1 x nParams row vector that is a view of the larger (MLN/CG) gradients array
      • logTestMode

        public void logTestMode​(boolean training)
      • getInsideLayer

        public Layer getInsideLayer()