FC

class neuralhydrology.modelzoo.fc.FC(input_size: int, hidden_sizes: List[int], activation: str = 'tanh', dropout: float = 0.0)

Bases: Module

Auxiliary class to build (multi-layer) fully-connected networks.

This class is used to build fully-connected embedding networks for static and/or dynamic input data. Use the config argument statics/dynamics_embedding to specify the architecture of the embedding network. See the InputLayer class on how to specify the exact embedding architecture.

Parameters:
  • input_size (int) – Number of input features.

  • hidden_sizes (List[int]) – Size of the hidden and output layers.

  • activation (str, optional) – Activation function for intermediate layers, default tanh.

  • dropout (float, optional) – Dropout rate in intermediate layers.

forward(x: Tensor) Tensor

Perform a forward pass on the FC model.

Parameters:

x (torch.Tensor) – Input data of shape [any, any, input size]

Returns:

Embedded inputs of shape [any, any, output_size], where ‘output_size’ is the size of the last network layer.

Return type:

torch.Tensor