hive.agents.qnets.conv module

class hive.agents.qnets.conv.ConvNetwork(in_dim, channels=None, mlp_layers=None, kernel_sizes=1, strides=1, paddings=0, normalization_factor=255, noisy=False, std_init=0.5)[source]

Bases: Module

Basic convolutional neural network architecture. Applies a number of convolutional layers (each followed by a ReLU activation), and then feeds the output into an hive.agents.qnets.mlp.MLPNetwork.

Note, if channels is None, the network created for the convolution portion of the architecture is simply an torch.nn.Identity module. If mlp_layers is None, the mlp portion of the architecture is an torch.nn.Identity module.

Parameters
  • in_dim (tuple) – The tuple of observations dimension (channels, width, height).

  • channels (list) – The size of output channel for each convolutional layer.

  • mlp_layers (list) – The number of neurons for each mlp layer after the convolutional layers.

  • kernel_sizes (list | int) – The kernel size for each convolutional layer

  • strides (list | int) – The stride used for each convolutional layer.

  • paddings (list | int) – The size of the padding used for each convolutional layer.

  • normalization_factor (float | int) – What the input is divided by before the forward pass of the network.

  • noisy (bool) – Whether the MLP part of the network will use NoisyLinear layers or torch.nn.Linear layers.

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

training: bool
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.