gomoku_rl.utils.module module

class gomoku_rl.utils.module.ActorNet(residual_tower: ResidualTower, out_features: int, num_channels: int = 32)[source]

Bases: Module

forward(x: Tensor, mask: Tensor | None = None) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.MyDuelingCnnDQNet(in_channels: int, out_features: int, num_residual_blocks: int = 3, num_channels: int = 32)[source]

Bases: Module

forward(x: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.PolicyHead(out_features: int, num_channels: int)[source]

Bases: _PolicyHead

forward(x: Tensor, mask: Tensor | None = None) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.ResidualBlock(num_channels: int, track_running_stats: bool = True)[source]

Bases: Module

forward(x: Tensor)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.ResidualTower(in_channels: int, num_channels: int, num_residual_blocks: int, track_running_stats: bool = True)[source]

Bases: Module

forward(x: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.ValueHead(num_channels: int, track_running_stats: bool = True)[source]

Bases: Module

forward(x: Tensor) Tensor[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class gomoku_rl.utils.module.ValueNet(residual_tower: ResidualTower, num_channels: int = 32)[source]

Bases: Module

forward(x: Tensor)[source]

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

gomoku_rl.utils.module.count_parameters(model: Module)[source]
gomoku_rl.utils.module.init_params(m: Module)[source]