Package org.deeplearning4j.nn.params
Class PretrainParamInitializer
- java.lang.Object
-
- org.deeplearning4j.nn.params.DefaultParamInitializer
-
- org.deeplearning4j.nn.params.PretrainParamInitializer
-
- All Implemented Interfaces:
ParamInitializer
public class PretrainParamInitializer extends DefaultParamInitializer
Pretrain weight initializer. Has the visible bias as well as hidden and weight matrix.- Author:
- Adam Gibson
-
-
Field Summary
Fields Modifier and Type Field Description static String
VISIBLE_BIAS_KEY
-
Fields inherited from class org.deeplearning4j.nn.params.DefaultParamInitializer
BIAS_KEY, GAIN_KEY, WEIGHT_KEY
-
-
Constructor Summary
Constructors Constructor Description PretrainParamInitializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected INDArray
createVisibleBias(NeuralNetConfiguration conf, INDArray visibleBiasView, boolean initializeParameters)
Map<String,INDArray>
getGradientsFromFlattened(NeuralNetConfiguration conf, INDArray gradientView)
Return a map of gradients (in their standard non-flattened representation), taken from the flattened (row vector) gradientView array.static PretrainParamInitializer
getInstance()
Map<String,INDArray>
init(NeuralNetConfiguration conf, INDArray paramsView, boolean initializeParams)
Initialize the parameterslong
numParams(NeuralNetConfiguration conf)
-
Methods inherited from class org.deeplearning4j.nn.params.DefaultParamInitializer
biasKeys, createBias, createBias, createGain, createGain, createWeightMatrix, createWeightMatrix, hasBias, hasLayerNorm, isBiasParam, isWeightParam, numParams, paramKeys, weightKeys
-
-
-
-
Field Detail
-
VISIBLE_BIAS_KEY
public static final String VISIBLE_BIAS_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static PretrainParamInitializer getInstance()
-
numParams
public long numParams(NeuralNetConfiguration conf)
- Specified by:
numParams
in interfaceParamInitializer
- Overrides:
numParams
in classDefaultParamInitializer
-
init
public Map<String,INDArray> init(NeuralNetConfiguration conf, INDArray paramsView, boolean initializeParams)
Description copied from interface:ParamInitializer
Initialize the parameters- Specified by:
init
in interfaceParamInitializer
- Overrides:
init
in classDefaultParamInitializer
- Parameters:
conf
- the configurationparamsView
- a view of the full network (backprop) parametersinitializeParams
- if true: initialize the parameters according to the configuration. If false: don't modify the values in the paramsView array (but do select out the appropriate subset, reshape etc as required)- Returns:
- Map of parameters keyed by type (view of the 'paramsView' array)
-
createVisibleBias
protected INDArray createVisibleBias(NeuralNetConfiguration conf, INDArray visibleBiasView, boolean initializeParameters)
-
getGradientsFromFlattened
public Map<String,INDArray> getGradientsFromFlattened(NeuralNetConfiguration conf, INDArray gradientView)
Description copied from interface:ParamInitializer
Return a map of gradients (in their standard non-flattened representation), taken from the flattened (row vector) gradientView array. The idea is that operates in exactly the same way as the paramsView does in#init(Map, NeuralNetConfiguration, INDArray)
; thus the position in the view (and, the array orders) must match those of the parameters- Specified by:
getGradientsFromFlattened
in interfaceParamInitializer
- Overrides:
getGradientsFromFlattened
in classDefaultParamInitializer
- Parameters:
conf
- ConfigurationgradientView
- The flattened gradients array, as a view of the larger array- Returns:
- A map containing an array by parameter type, that is a view of the full network gradients array
-
-