model.network
model.network
ResNet policy-value network for backgammon.
Classes
| Name | Description |
|---|---|
| RaccoonNet | ResNet with policy and value heads for backgammon. |
| ResidualBlock | Conv3x3 -> BN -> ReLU -> Conv3x3 -> BN -> skip add -> ReLU. |
RaccoonNet
model.network.RaccoonNet(
in_channels=26,
board_h=2,
board_w=12,
num_actions=1352,
channels=128,
num_blocks=6,
feature_channels=None,
input_bn=False,
value_head='scalar',
)ResNet with policy and value heads for backgammon.
Methods
| Name | Description |
|---|---|
| forward | Forward pass. |
| predict | Single-position inference for MCTS. |
| predict_batch | Batched inference for multiple positions. |
| value_equity | Scalar equity/3 in [-1, 1] per position, for both head types. |
forward
model.network.RaccoonNet.forward(x)Forward pass.
Args: x: (batch, in_channels, 2, 12)
Returns: policy_logits: (batch, 1352) raw logits (not masked) value: “scalar” head -> (batch, 1) tanh in [-1, 1]; “outcomes6” head -> (batch, 6) raw logits (softmax applied by the caller / value_equity).
predict
model.network.RaccoonNet.predict(obs, legal_actions)Single-position inference for MCTS.
Args: obs: (C, 2, 12) numpy array (C = in_channels) legal_actions: list of valid action indices
Returns: policy: dict mapping action -> probability (sums to ~1, only legal) value: scalar float in [-1, 1]
predict_batch
model.network.RaccoonNet.predict_batch(obs_list, legal_actions_list)Batched inference for multiple positions.
Args: obs_list: list of (C, 2, 12) numpy arrays (C = in_channels) legal_actions_list: list of legal action lists
Returns: list of (policy_dict, value) tuples
value_equity
model.network.RaccoonNet.value_equity(x)Scalar equity/3 in [-1, 1] per position, for both head types.
This is what 0-ply move selection reads (see lookahead.eval_values_batch), so a scalar net and an outcomes6 net are interchangeable at play time.
ResidualBlock
model.network.ResidualBlock(channels)Conv3x3 -> BN -> ReLU -> Conv3x3 -> BN -> skip add -> ReLU.
Functions
| Name | Description |
|---|---|
| load_model | Create a RaccoonNet from a checkpoint, using its saved config. |
load_model
model.network.load_model(path)Create a RaccoonNet from a checkpoint, using its saved config.
Falls back to default config for older checkpoints without config.