Skip to content

TimeAveragedRNN

Source code

Bases: tf.keras.layers.Layer

A simple RNN with time-averaging output.

Note

This layer unrolls TimeAveragedRNNCell for a fixed number of steps. The number of steps is determined by "sequence length" in axis 1 of input tensor's shape.

Parameters:

Name Type Description Default
tau float

Time-averaging parameter, from 0 to 1.

required
units int

Number of units in the RNN cell.

required

build(input_shape)

Build the underlying layers/weights.

call(inputs)

Forward pass.

Parameters:

Name Type Description Default
inputs tf.Tensor

Input tensor xtx_t with shape (batch_size, seq_len, input_dim).

required

Returns:

Name Type Description
outputs tf.Tensor

Output tensor hth_t with shape (batch_size, seq_len, units).