MLP

class dhg.nn.MLP(*args, **kwargs)[source]

Bases: torch.nn.Module

A Multi-Layer Perception (MLP) model.

Parameters
  • channel_list (List[int]) – The list of channels of each layer.

  • act_name (str) – The name of activation function can be any activation layer in Pytorch.

  • act_kwargs (dict, optional) – The keyword arguments of activation function. Defaults to None.

  • use_bn (bool) – Whether to use batch normalization.

  • drop_rate (float) – Dropout ratio. Defaults to 0.5.

  • is_last (bool) – If set to True, the last layer will not use activation, batch normalization, and dropout.

forward(X)[source]

The forward function.