class

MicroGPT::GatedRouter

Inherits MicroGPT::Router < Reference < Object

Constructors

new(n_routed : Int32, stream_dim : Int32, vocab_size : Int32)
Source

Instance methods

adam_emb
Source
adam_mats

Adam state matrices (2 per weight mat: m, v)

Source
backward(d_router_probs : Mat, lr : Float64) : Mat

Backward: given d_router_probs [seq_len, n_routed], compute gradients and return d_stream contribution from router. Updates own params.

Source
d_router_emb
Source
describe

Human-readable description

Source
forward(input_ids : Array(Int32), stream : Mat) : Mat

Forward: compute per-position blended router probs [seq_len, n_routed] Also caches state needed for backward.

Source
grad_mats

Gradient matrices (same order as weight_mats)

Source
param_count

Parameter count

Source
router_emb
Source
w_gate
Source
w_router
Source
weight_mats

Weight matrices for serialization (WeightStore)

Source