ray.rllib.models.torch.torch_modelv2.TorchModelV2.__init__#

TorchModelV2.__init__(obs_space: gymnasium.spaces.Space, action_space: gymnasium.spaces.Space, num_outputs: int, model_config: dict, name: str)[源代码]#

初始化一个 TorchModelV2。

以下是一个子类 MyModelClass(TorchModelV2, nn.Module) 的示例实现:

def __init__(self, *args, **kwargs):
    TorchModelV2.__init__(self, *args, **kwargs)
    nn.Module.__init__(self)
    self._hidden_layers = nn.Sequential(...)
    self._logits = ...
    self._value_branch = ...