public class DefaultParamInitializer extends java.lang.Object implements ParamInitializer
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BIAS_KEY |
static java.lang.String |
WEIGHT_KEY |
Constructor and Description |
---|
DefaultParamInitializer() |
Modifier and Type | Method and Description |
---|---|
protected org.nd4j.linalg.api.ndarray.INDArray |
createBias(int nOut,
double biasInit,
org.nd4j.linalg.api.ndarray.INDArray biasParamView,
boolean initializeParameters) |
protected org.nd4j.linalg.api.ndarray.INDArray |
createBias(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray biasParamView,
boolean initializeParameters) |
protected org.nd4j.linalg.api.ndarray.INDArray |
createWeightMatrix(int nIn,
int nOut,
WeightInit weightInit,
org.nd4j.linalg.api.rng.distribution.Distribution dist,
org.nd4j.linalg.api.ndarray.INDArray weightParamView,
boolean initializeParameters) |
protected org.nd4j.linalg.api.ndarray.INDArray |
createWeightMatrix(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray weightParamView,
boolean initializeParameters) |
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> |
getGradientsFromFlattened(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray gradientView)
Return a map of gradients (in their standard non-flattened representation), taken from the flattened (row vector) gradientView array.
|
static DefaultParamInitializer |
getInstance() |
java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> |
init(NeuralNetConfiguration conf,
org.nd4j.linalg.api.ndarray.INDArray paramsView,
boolean initializeParams)
Initialize the parameters
|
int |
numParams(NeuralNetConfiguration conf) |
public static final java.lang.String WEIGHT_KEY
public static final java.lang.String BIAS_KEY
public static DefaultParamInitializer getInstance()
public int numParams(NeuralNetConfiguration conf)
numParams
in interface ParamInitializer
public java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> init(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray paramsView, boolean initializeParams)
ParamInitializer
init
in interface ParamInitializer
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)public java.util.Map<java.lang.String,org.nd4j.linalg.api.ndarray.INDArray> getGradientsFromFlattened(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray gradientView)
ParamInitializer
#init(Map, NeuralNetConfiguration, INDArray)
;
thus the position in the view (and, the array orders) must match those of the parametersgetGradientsFromFlattened
in interface ParamInitializer
conf
- ConfigurationgradientView
- The flattened gradients array, as a view of the larger arrayprotected org.nd4j.linalg.api.ndarray.INDArray createBias(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray biasParamView, boolean initializeParameters)
protected org.nd4j.linalg.api.ndarray.INDArray createBias(int nOut, double biasInit, org.nd4j.linalg.api.ndarray.INDArray biasParamView, boolean initializeParameters)
protected org.nd4j.linalg.api.ndarray.INDArray createWeightMatrix(NeuralNetConfiguration conf, org.nd4j.linalg.api.ndarray.INDArray weightParamView, boolean initializeParameters)
protected org.nd4j.linalg.api.ndarray.INDArray createWeightMatrix(int nIn, int nOut, WeightInit weightInit, org.nd4j.linalg.api.rng.distribution.Distribution dist, org.nd4j.linalg.api.ndarray.INDArray weightParamView, boolean initializeParameters)