netket.models.AbstractARNN#

class netket.models.AbstractARNN[source]#

Bases: flax.linen.module.Module

Base class for autoregressive neural networks.

Subclasses must implement the methods __call__ and conditionals. They can also override _conditional to implement the caching for fast autoregressive sampling. See netket.nn.FastARNNConv1D for example.

They must also implement the field machine_pow, which specifies the exponent to normalize the outputs of __call__.

Attributes
variables#

Returns the variables in this module.

Return type

Mapping[str, Mapping[str, Any]]

hilbert: netket.hilbert.HomogeneousHilbert#

the Hilbert space. Only homogeneous unconstrained Hilbert spaces are supported.

Methods
abstract conditionals(inputs)[source]#

Computes the conditional probabilities for each site to take each value.

Parameters

inputs (Union[ndarray, DeviceArray, Tracer]) – configurations with dimensions (batch, Hilbert.size).

Return type

Union[ndarray, DeviceArray, Tracer]

Returns

The probabilities with dimensions (batch, Hilbert.size, Hilbert.local_size).

Examples

>>> import pytest; pytest.skip("skip automated test of this docstring")
>>>
>>> p = model.apply(variables, σ, method=model.conditionals)
>>> print(p[2, 3, :])
[0.3 0.7]
# For the 3rd spin of the 2nd sample in the batch,
# it takes probability 0.3 to be spin down (local state index 0),
# and probability 0.7 to be spin up (local state index 1).
has_rng(name)#

Returns true if a PRNGSequence with name name exists.

Return type

bool

Parameters

name (str) –

put_variable(col, name, value)#

Sets the value of a Variable.

Parameters
  • col (str) – the variable collection.

  • name (str) – the name of the variable.

  • value (Any) – the new value of the variable.

Returns: