netket.nn#
This sub-module extends flax.linen with layers and tools that are useful to applications in quantum physics. Read more about the design goal of this module in their README
Linear Modules#
Implements a projection onto a symmetry group. |
|
A group convolution operation that is equivariant over a symmetry group. |
The following modules can be used in autoregressive neural networks, see AbstractARNN
1D linear transformation module with mask for autoregressive NN. |
|
1D convolution module with mask for autoregressive NN. |
|
2D convolution module with mask for autoregressive NN. |
|
1D linear transformation module with mask for fast autoregressive NN. |
|
1D convolution module with mask for fast autoregressive NN. |
|
2D convolution module with mask for fast autoregressive NN. |
Activation functions#
Modifies a non-linearity to act separately on the real and imaginary parts |
|
relu applied separately to the real andimaginary parts of it's input. |
|
selu applied separately to the real andimaginary parts of it's input. |
|
Logarithm of the hyperbolic cosine, implemented in a more stable way. |
|
Logarithm of the hyperbolic sine. |
|
Logarithm of the hyperbolic tangent. |
Miscellaneous Functions#
|
Encodes the array x into a set of binary-encoded variables described by the shape of a Hilbert space. |
Utility functions#
Apply Operator#
The netket.nn.apply_operator submodule provides modules and utilities to
construct a new neural-network state \(\log(O\lvert\psi\rangle)\) wrapping an
existing model and an operator \(O\). This is used internally by NetKet when computing expectation values, but can also be used directly to build custom models.
A Flax Linen module that wraps another module and applies an operator transformation. |
|
A Flax NNX module that wraps another NNX module and applies an operator transformation. |
|
Wraps an apply_fun into another one that multiplies it by an operator. |
Freezing parameters#
The freeze_parameters() function provides a framework-agnostic way to freeze (prevent optimization of) a subset of a model’s parameters. It moves
the selected parameters out of the trainable "params" collection. The
choice of which parameters to freeze is controlled by a
filter function (path, leaf) -> bool.
See also the freezing parameters example for a worked example.
Freeze a subset of model parameters, identified by a filter function. |
|
Restore all frozen parameters to the trainable |
Blocks#
A Multi-Layer Perceptron with hidden layers. |
|
Implements the DeepSets architecture, which is permutation invariant and is suitable for the encoding of bosonic systems. |
|
A wrapper module to symmetrise a variational wave function with respect to a permutation group \(G\) by summing over all permuted inputs. |
Experimental#
Recurrent Neural Network cells#
The following are RNN layers (in flax those would be called a RNN), which can be stacked within a netket.experimental.models.RNN.
Recurrent neural network layer that maps inputs at N sites to outputs at N sites. |
|
Recurrent neural network layer with fast sampling. |
The following are recurrent cells that can be used with netket.experimental.nn.rnn.RNNLayer.
Recurrent neural network cell that updates the hidden memory at each site. |
|
Long short-term memory cell. |
|
Gated recurrent unit cell. |
The following are utility functions to build up custom autoregressive orderings.
Check that the reordering indices determining the autoregressive order of an RNN are correctly declared. |
|
Deduce the missing arguments between reorder_idx, inv_reorder_idx, and inv_reorder_idx from the specified arguments. |
|
A helper function to generate the inverse reorder indices in the snake order for a 2D graph. |