HNSLayer
Bases: tf.keras.layers.Layer
Hub-and-Spokes RNN Layer.
Unrolling the HNSCell for a fixed number of time steps.
See Rogers et. al., 2004 for more details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tau |
float
|
Time constant of the time-averaging. |
required |
hub_name |
str
|
Name of the hub layer. |
required |
hub_units |
int
|
Number of units in the hub layer. |
required |
spoke_names |
List[str]
|
Names of the spoke layers. |
required |
spoke_units |
List[int]
|
Number of units in each spoke layer. Must be the same length as |
required |
build(input_shape)
Build the HNSCell.
call(inputs=None, return_internals=False)
Forward pass: unroll the HNSCell for a fixed number of time steps.
The number of time steps is determined by axis 1 in the inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
inputs |
Dict[str, tf.Tensor]
|
Inputs to the spokes (name as key). Assumes input is 0 if not given. |
None
|
return_internals |
bool
|
Whether to return intermediate inputs to each connection. |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, tf.Tensor]
|
Dict[str, tf.Tensor]: Activations of the hub and spokes, with layer names as keys.
If |