hive.agents.qnets.mlp module

class hive.agents.qnets.mlp.MLPNetwork(in_dim, hidden_units=256, noisy=False, std_init=0.5)[source]

Bases: Module

Basic MLP neural network architecture.

Contains a series of torch.nn.Linear or NoisyLinear layers, each of which is followed by a ReLU.

Parameters
  • in_dim (tuple[int]) – The shape of input observations.

  • hidden_units (int | list[int]) – The number of neurons for each mlp layer.

  • noisy (bool) – Whether the MLP should use NoisyLinear layers or normal torch.nn.Linear layers.

  • std_init (float) – The range for the initialization of the standard deviation of the weights in NoisyLinear.

forward(x)[source]

Defines 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.

training: bool