Skip to content

Build · Topology (matrix)

self_loop_cycle

Build a directed cycle with a constant self-connection on every unit.

self_loop_cycle

Connectivity and weight matrix on a small reservoir.
from resdag.layers import ESNLayer

reservoir = ESNLayer(500, feedback_size=3, recurrent_initializer='self_loop_cycle', spectral_radius=0.9, seed=7)
parameter default
cycle_weight 0.1
self_loop_weight 0.1
dtype torch.float32
device None

Override parameters with recurrent_initializer=("self_loop_cycle", {...}) or pre-configure with get_recurrent_initializer("self_loop_cycle", ...). The existing topology= spelling and get_topology() also work.

A layer spectral_radius rescales this matrix after construction. Use get_recurrent_initializer(..., rescale=False) to keep the native scale.

See also