GRUCellMML¶
- class keras_mml.layers.recurrent.GRUCellMML[source]¶
Cell class for the
GRUMMLlayer.This class processes one step within the whole time sequence input, whereas
GRUMMLprocesses the whole sequence.- units¶
Dimensionality of the output space.
- fully_mml¶
Whether to use matmul-free operations for all the layers.
- num_heads¶
Number of heads to use when performing the recurrent step.
- activation¶
Activation function to use.
- recurrent_activation¶
Activation function to use for the recurrent step.
- use_bias¶
Whether to use a bias vector for the layer.
- weights_initializer¶
Initializer for the gates’ matrices. Used for the linear transformation of the inputs.
- bias_initializer¶
Initializer for the bias vector.
- weights_regularizer¶
Regularizer function applied to the gates’ matrices.
- bias_regularizer¶
Regularizer function applied to the bias vector.
- weights_constraint¶
Constraint function applied to the gates’ matrices.
- bias_constraint¶
Constraint function applied to the bias vector.
- state_size¶
Size of the recurrent state.
- output_size¶
Size of the output vector.
- __init__(units, fully_mml=False, num_heads=1, activation='silu', recurrent_activation='sigmoid', use_bias=True, weights_initializer='glorot_uniform', bias_initializer='zeros', weights_regularizer=None, bias_regularizer=None, weights_constraint=None, bias_constraint=None, **kwargs)[source]¶
Initializes a new instance of the layer.
- Parameters:
units (
int) – Dimensionality of the output space.fully_mml (
bool, default:False) – Whether to use matmul-free operations for all the layers.num_heads (
int, default:1) – Number of heads to use when performing the recurrent step.activation (
str, default:'silu') – Activation function to use.recurrent_activation (
str, default:'sigmoid') – Activation function to use for the recurrent step.use_bias (
bool, default:True) – Whether to use a bias vector for the layer.weights_initializer (
str, default:'glorot_uniform') – Initializer for the gates’ matrices. Used for the linear transformation of the inputs.bias_initializer (
str, default:'zeros') – Initializer for the bias vector.weights_regularizer (
Optional[str], default:None) – Regularizer function applied to the gates’ matrices.bias_regularizer (
Optional[str], default:None) – Regularizer function applied to the bias vector.weights_constraint (
Optional[str], default:None) – Constraint function applied to the gates’ matrices.bias_constraint (
Optional[str], default:None) – Constraint function applied to the bias vector.**kwargs – Keyword arguments for
keras.Layer.
- Raises:
ValueError – If the units provided is not a positive integer.
ValueError – If the number of heads to use is not a positive integer.
ValueError – If the number of heads does not divide the units provided.
- call(inputs, states, training=False)[source]¶
Calling method of the cell.
- Parameters:
inputs (
Float[ndarray, 'batch_size features']) – Inputs into the layer.states (
Float[ndarray, '*state_dims']) – State(s) from the previous timestep.training (default:
False) – Whether the layer should behave in training mode or in inference mode.
- Returns:
Float[ndarray, 'batch_size units']– Transformed inputs.