Package org.deeplearning4j.nn.params
Class VariationalAutoencoderParamInitializer
- java.lang.Object
-
- org.deeplearning4j.nn.params.DefaultParamInitializer
-
- org.deeplearning4j.nn.params.VariationalAutoencoderParamInitializer
-
- All Implemented Interfaces:
ParamInitializer
public class VariationalAutoencoderParamInitializer extends DefaultParamInitializer
-
-
Field Summary
Fields Modifier and Type Field Description static String
BIAS_KEY_SUFFIX
static String
DECODER_PREFIX
static String
ENCODER_PREFIX
static String
PXZ_B
Key for bias parameters connecting the last decoder layer and p(data|z) (according to whateverReconstructionDistribution
is set for the VAE)static String
PXZ_PREFIX
static String
PXZ_W
Key for weight parameters connecting the last decoder layer and p(data|z) (according to whateverReconstructionDistribution
is set for the VAE)static String
PZX_LOGSTD2_B
Key for bias parameters for log(sigma^2) in p(z|data)static String
PZX_LOGSTD2_PREFIX
static String
PZX_LOGSTD2_W
Key for weight parameters connecting the last encoder layer and the log(sigma^2) values for p(z|data)static String
PZX_MEAN_B
Key for bias parameters for the mean values for p(z|data)static String
PZX_MEAN_PREFIX
static String
PZX_MEAN_W
Key for weight parameters connecting the last encoder layer and the mean values for p(z|data)static String
PZX_PREFIX
static String
WEIGHT_KEY_SUFFIX
-
Fields inherited from class org.deeplearning4j.nn.params.DefaultParamInitializer
BIAS_KEY, GAIN_KEY, WEIGHT_KEY
-
-
Constructor Summary
Constructors Constructor Description VariationalAutoencoderParamInitializer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
biasKeys(Layer layer)
Bias parameter keys given the layer configurationMap<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 VariationalAutoencoderParamInitializer
getInstance()
Map<String,INDArray>
init(NeuralNetConfiguration conf, INDArray paramsView, boolean initializeParams)
Initialize the parametersboolean
isBiasParam(Layer layer, String key)
Is the specified parameter a bias?boolean
isWeightParam(Layer layer, String key)
Is the specified parameter a weight?long
numParams(NeuralNetConfiguration conf)
List<String>
paramKeys(Layer l)
Get a list of all parameter keys given the layer configurationList<String>
weightKeys(Layer layer)
Weight parameter keys given the layer configuration-
Methods inherited from class org.deeplearning4j.nn.params.DefaultParamInitializer
createBias, createBias, createGain, createGain, createWeightMatrix, createWeightMatrix, hasBias, hasLayerNorm, numParams
-
-
-
-
Field Detail
-
WEIGHT_KEY_SUFFIX
public static final String WEIGHT_KEY_SUFFIX
- See Also:
- Constant Field Values
-
BIAS_KEY_SUFFIX
public static final String BIAS_KEY_SUFFIX
- See Also:
- Constant Field Values
-
PZX_PREFIX
public static final String PZX_PREFIX
- See Also:
- Constant Field Values
-
PZX_MEAN_PREFIX
public static final String PZX_MEAN_PREFIX
- See Also:
- Constant Field Values
-
PZX_LOGSTD2_PREFIX
public static final String PZX_LOGSTD2_PREFIX
- See Also:
- Constant Field Values
-
ENCODER_PREFIX
public static final String ENCODER_PREFIX
- See Also:
- Constant Field Values
-
DECODER_PREFIX
public static final String DECODER_PREFIX
- See Also:
- Constant Field Values
-
PZX_MEAN_W
public static final String PZX_MEAN_W
Key for weight parameters connecting the last encoder layer and the mean values for p(z|data)- See Also:
- Constant Field Values
-
PZX_MEAN_B
public static final String PZX_MEAN_B
Key for bias parameters for the mean values for p(z|data)- See Also:
- Constant Field Values
-
PZX_LOGSTD2_W
public static final String PZX_LOGSTD2_W
Key for weight parameters connecting the last encoder layer and the log(sigma^2) values for p(z|data)- See Also:
- Constant Field Values
-
PZX_LOGSTD2_B
public static final String PZX_LOGSTD2_B
Key for bias parameters for log(sigma^2) in p(z|data)- See Also:
- Constant Field Values
-
PXZ_PREFIX
public static final String PXZ_PREFIX
- See Also:
- Constant Field Values
-
PXZ_W
public static final String PXZ_W
Key for weight parameters connecting the last decoder layer and p(data|z) (according to whateverReconstructionDistribution
is set for the VAE)- See Also:
- Constant Field Values
-
PXZ_B
public static final String PXZ_B
Key for bias parameters connecting the last decoder layer and p(data|z) (according to whateverReconstructionDistribution
is set for the VAE)- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static VariationalAutoencoderParamInitializer getInstance()
-
numParams
public long numParams(NeuralNetConfiguration conf)
- Specified by:
numParams
in interfaceParamInitializer
- Overrides:
numParams
in classDefaultParamInitializer
-
paramKeys
public List<String> paramKeys(Layer l)
Description copied from interface:ParamInitializer
Get a list of all parameter keys given the layer configuration- Specified by:
paramKeys
in interfaceParamInitializer
- Overrides:
paramKeys
in classDefaultParamInitializer
- Parameters:
l
- Layer- Returns:
- All parameter keys
-
weightKeys
public List<String> weightKeys(Layer layer)
Description copied from interface:ParamInitializer
Weight parameter keys given the layer configuration- Specified by:
weightKeys
in interfaceParamInitializer
- Overrides:
weightKeys
in classDefaultParamInitializer
- Parameters:
layer
- Layer- Returns:
- Weight parameter keys
-
biasKeys
public List<String> biasKeys(Layer layer)
Description copied from interface:ParamInitializer
Bias parameter keys given the layer configuration- Specified by:
biasKeys
in interfaceParamInitializer
- Overrides:
biasKeys
in classDefaultParamInitializer
- Parameters:
layer
- Layer- Returns:
- Bias parameter keys
-
isWeightParam
public boolean isWeightParam(Layer layer, String key)
Description copied from interface:ParamInitializer
Is the specified parameter a weight?- Specified by:
isWeightParam
in interfaceParamInitializer
- Overrides:
isWeightParam
in classDefaultParamInitializer
- Parameters:
layer
- Layerkey
- Key to check- Returns:
- True if parameter is a weight
-
isBiasParam
public boolean isBiasParam(Layer layer, String key)
Description copied from interface:ParamInitializer
Is the specified parameter a bias?- Specified by:
isBiasParam
in interfaceParamInitializer
- Overrides:
isBiasParam
in classDefaultParamInitializer
- Parameters:
layer
- Layerkey
- Key to check- Returns:
- True if parameter is a bias
-
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)
-
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
-
-