netket.experimental.nn.rnn.FastRNNLayer#

class netket.experimental.nn.rnn.FastRNNLayer[source]#

Bases: RNNLayer

Recurrent neural network layer with fast sampling.

See netket.models.FastARNNSequential for a brief explanation of fast autoregressive sampling.

Attributes
size: int = None#

number of sites.

cell: RNNCell#

cell to update the hidden memory at each site, such as LSTM or GRU.

exclusive: bool#

True if an output element does not depend on the input element at the same index.

Methods
__call__(inputs)[source]#

Applies the RNN cell to a batch of input sequences.

Parameters:

inputs (Union[ndarray, Array]) – input data with dimensions (batch, n_sites, features).

Return type:

Union[ndarray, Array]

Returns:

The output sequences.

update_site(inputs, index)[source]#

Applies the RNN cell to a batch of input sites at a given index, and stores the updated memories in the cache.

Parameters:
  • inputs (Union[ndarray, Array]) – an input site with dimensions (batch, features).

  • index (int) – the index of the output site. The index of the input site should be index - self.exclusive.

Return type:

Union[ndarray, Array]

Returns:

The output site with dimensions (batch, features).