LRUCellMML

class keras_mml.layers.recurrent.LRUCellMML[source]

Cell class for the LRUMML layer.

This class processes one step within the whole time sequence input, whereas LRUMML processes the whole sequence.

units

Dimensionality of the output space.

state_dim

Dimensionality of the internal state space.

fully_mml

Whether to use matmul-free operations for all the layers.

r_min

Minimum modulus of the complex weights in \(\mathbf{\Lambda}\).

r_max

Maximum modulus of the complex weights in \(\mathbf{\Lambda}\).

max_phase

Maximum phase of the complex weights in \(\mathbf{\Lambda}\).

use_bias

Whether to use a bias vector for the layer.

state_size

Size of the recurrent state.

output_size

Size of the output vector.

__init__(units, state_dim, fully_mml=False, r_min=0, r_max=1, max_phase=6.283185307179586, use_bias=False, **kwargs)[source]

Initializes a new instance of the layer.

Parameters:
  • units (int) – Dimensionality of the output space.

  • state_dim (int) – Dimensionality of the internal state space.

  • fully_mml (bool, default: False) – Whether to use matmul-free operations for all the layers.

  • r_min (float, default: 0) – Minimum modulus of the complex weights in \(\mathbf{\Lambda}\).

  • r_max (float, default: 1) – Maximum modulus of the complex weights in \(\mathbf{\Lambda}\).

  • max_phase (float, default: 6.283185307179586) – Maximum phase of the complex weights in \(\mathbf{\Lambda}\).

  • use_bias (bool, default: False) – Whether to use a bias vector for the layer.

  • **kwargs – Keyword arguments for keras.Layer.

Raises:
  • ValueError – If the units provided is not a positive integer.

  • ValueError – If the state dimensionality provided is not a positive integer.

build(input_shape)[source]

Create layer weights.

Parameters:

input_shape (Tuple[int, int]) – Shape of the input.

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.

get_config()[source]

Gets the configuration for the layer.

Returns:

Layer configuration.

get_initial_state(batch_size=None)[source]

Gets the initial states.

Parameters:

batch_size (Optional[int], default: None) – Batch size for the cell.

Returns:

List[ndarray] – Initial states.