osl_dynamics.inference.initializers
#
Initializers for TensorFlow layers.
Module Contents#
Classes#
Initialize weights to given value. |
|
Initialize weights to given value with random noise added. |
|
Initialize weights to a flattened cholesky factor of identity |
|
Initialize weights to a flattened cholesky factor of identity |
|
Initialize weights to a flattened cholesky factor of correlation |
|
Initializer for diagonal matrices with a normal error added. |
|
Initialize weights to another Tensor's value. |
Functions#
|
Re-initializes the weights in a particular layer. |
|
Re-initialize the weights in a model. |
Attributes#
- class osl_dynamics.inference.initializers.WeightInitializer(initial_value)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to given value.
- Parameters:
initial_value (np.ndarray) – Value to initialise weights to. Note, the shape is not checked.
- class osl_dynamics.inference.initializers.RandomWeightInitializer(initial_value, std)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to given value with random noise added.
- Parameters:
initial_value (np.ndarray) – Value to initialise weights to. Note, the shape is not checked.
std (float) – Standard deviation of the noise to add.
- class osl_dynamics.inference.initializers.IdentityCholeskyInitializer[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to a flattened cholesky factor of identity matrices.
- class osl_dynamics.inference.initializers.NormalIdentityCholeskyInitializer(std)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to a flattened cholesky factor of identity matrices with a normal error added to the diagonal.
- Parameters:
std (float) – Standard deviation of the error to add.
- class osl_dynamics.inference.initializers.NormalCorrelationCholeskyInitializer(std)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to a flattened cholesky factor of correlation matrices with a normal error added to the flattened cholesky factor.
- Parameters:
mean (float) – Mean of the error to add.
std (float) – Standard deviation of the error to add.
- class osl_dynamics.inference.initializers.NormalDiagonalInitializer(std)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initializer for diagonal matrices with a normal error added.
- Parameters:
std (float) – Standard deviation of the error to add.
- class osl_dynamics.inference.initializers.CopyTensorInitializer(tensor)[source]#
Bases:
tensorflow.keras.initializers.Initializer
Initialize weights to another Tensor’s value.
- Parameters:
tensor (tf.Tensor) – Tensor to copy.
- osl_dynamics.inference.initializers.reinitialize_layer_weights(layer)[source]#
Re-initializes the weights in a particular layer.
- Parameters:
layer (tf.keras.layers.Layer) – Layer to initialize weights for.
Note
This function relies on each layer having an attribute for the initializer. Standard TensorFlow layers have this. You must specify a
self.*_initializer
attribute in any custom layer, otherwise this function will break.