layers Package
layers
Package
Package provides custom layers that are used for some of the models used in the estimators.
dense_mixture
Module
- class sde_calibration.dnn_estimators.layers.dense_mixture.DenseMixture(num_components=10, label_dimensionality=1, **kwargs)
Bases:
tensorflow.python.keras.engine.base_layer.Layer
Class providing a dense layer that is setup to be used for a mixture density network (MDN)
- Parameters
num_components (int, optional) –
Gives the number of components in the Gaussian mixture model (GMM).
|default|
10
label_dimensionality (int, optional) – Number of dimensions for the response variables. |default|
1
**kwargs –
Additional keyword arguments passed to the base class
tensorflow.python.keras.engine.base_layer.Layer
. The documentation can be found here.
- call(inputs)
This is where the layer’s logic lives.
Note here that call() method in tf.keras is little bit different from keras API. In keras API, you can pass support masking for layers as additional arguments. Whereas tf.keras has compute_mask() method to support masking.
- get_config()
Returns the config of the layer.
A layer config is a Python dictionary (serializable) containing the configuration of a layer. The same layer can be reinstantiated later (without its trained weights) from this configuration.
The config of a layer does not include connectivity information, nor the layer class name. These are handled by Network (one layer of abstraction above).
Note that get_config() does not guarantee to return a fresh copy of dict every time it is called. The callers should make a copy of the returned dict if they want to modify it.
- Returns:
Python dictionary.
mc_dropout
Module
- class sde_calibration.dnn_estimators.layers.mc_dropout.MCDropout(*args, **kwargs)
Bases:
tensorflow.python.keras.layers.core.Dropout
- call(inputs, **kwargs)
This is where the layer’s logic lives.
Note here that call() method in tf.keras is little bit different from keras API. In keras API, you can pass support masking for layers as additional arguments. Whereas tf.keras has compute_mask() method to support masking.