netket.experimental.models.RNN#
- class netket.experimental.models.RNN[source]#
Bases:
ARNNSequentialBase class for recurrent neural networks.
If either one of reorder_idx and inv_reorder_idx is unspecified, it can be deduced from another. If both are unspecified, they can be determined from graph.
If
prev_neighborsis unspecified, it can be determined fromgraphandreorder_idx.If all of
reorder_idx,inv_reorder_idx,prev_neighbors, andgraphare unspecified, there is a faster code path for 1D RNN.- Attributes
- graph: AbstractGraph | None = None#
graph of the physical system.
- inv_reorder_idx: HashableArray | None = None#
indices to transform the inputs from ordered to unordered. See
netket.models.AbstractARNN.reorder()for details.
- prev_neighbors: HashableArray | None = None#
previous neighbors of each site. An integer array of shape (hilbert.size, max_prev_neighbors). When the actual number of previous neighbors of a site is less than max_prev_neighbors, use -1 to denote zero paddings instead of memory from a neighbor.
- reorder_idx: HashableArray | None = None#
indices to transform the inputs from unordered to ordered. See
netket.models.AbstractARNN.reorder()for details.
- features: Iterable[int] | int#
output feature density in each layer. If a single number is given, all layers except the last one will have the same number of features.
- kernel_init: Callable[[Any, Sequence[int], None | str | type[Any] | dtype | _SupportsDType], Array]#
initializer for the weights.
- bias_init: Callable[[Any, Sequence[int], None | str | type[Any] | dtype | _SupportsDType], Array]#
initializer for the biases.
- hilbert: HomogeneousHilbert#
the Hilbert space. Only homogeneous unconstrained Hilbert spaces are supported.
- Methods
-
- inverse_reorder(inputs, axis=0)[source]#
Transforms an array from ordered to unordered. See reorder.
- reorder(inputs, axis=0)[source]#
Transforms an array from unordered to ordered.
We call a 1D array ‘unordered’ if we need non-trivial indexing to access its elements in the autoregressive order, e.g., a[0], a[1], a[3], a[2] for the snake order. Otherwise, we call it ‘ordered’.
The inputs of conditionals_log_psi, conditionals, conditional, and __call__ are assumed to have unordered layout, and those inputs are always transformed through reorder before evaluating the network.
Subclasses may override reorder and inverse_reorder together to define this transformation.