Skip to content
heliaEDGE
Reference
HELIA

streaming

Recurrent cells for streaming models whose state is an explicit model input and output. One model call processes one step: the caller feeds each state_out_k output back as the state_in_k input of the next call, and feeds zeros at the start of an independent sequence.

Classes

Name Description
StreamingLSTMCell One LSTM step with explicit hidden and cell state

Functions

Name Description
state_input Model input for state pair k
state_output Model output for state pair k

Machine-readable model

class

One LSTM step: [x, h, c] -> [h', c'].

helia_edge/layers/streaming.py:22

StreamingLSTMCell(units: int, use_bias: bool = True, unit_forget_bias: bool = True, **kwargs={})

One LSTM step: [x, h, c] -> [h', c'].

The weights have the layout of keras.layers.LSTMCell: kernel (features, 4 * units), recurrent_kernel (units, 4 * units) and bias (4 * units), with gates in the order input, forget, cell, output. Weights of a keras.layers.LSTM or LSTMCell load unchanged.

c’ = f * c + i * tanh(z_c) and h’ = o * tanh(c’), where z = x W + h R + b and i, f, o are the sigmoid of their slices of z.

Parameters of StreamingLSTMCell
NameTypeDefaultDescription
unitsintRequiredSize of the hidden and cell state.
use_biasboolTrueAdd ``bias`` to the gates.
unit_forget_biasboolTrueInitialize the forget gate's bias to one and the others to zero, as ``keras.layers.LSTMCell`` does.
function

Model input stateink for state pair k.

helia_edge/layers/streaming.py:92

state_input(k: int, shape: tuple[int, ...], batch_size: int | None = None) -> keras.KerasTensor

Model input state_in_k for state pair k.

Parameters of state_input
NameTypeDefaultDescription
kintRequiredState pair index; ``state_out_k`` is the matching output.
shapetuple[int, ...]RequiredState shape without the batch dimension.
batch_sizeint | NoneNoneFixed batch size, or None.
Returns of state_input
TypeDescription
keras.KerasTensorkeras.KerasTensor: The input tensor.
function

Name x as the model output stateoutk of state pair k.

helia_edge/layers/streaming.py:106

state_output(k: int, x: keras.KerasTensor) -> keras.KerasTensor

Name x as the model output state_out_k of state pair k.

Parameters of state_output
NameTypeDefaultDescription
kintRequiredState pair index; ``state_in_k`` is the matching input.
xkeras.KerasTensorRequiredThe next state.
Returns of state_output
TypeDescription
keras.KerasTensorkeras.KerasTensor: ``x`` through an identity layer named ``state_out_k``.