gnn_tracking.models.mlp
=======================

.. py:module:: gnn_tracking.models.mlp

.. autoapi-nested-parse::

   Fully connected neural network implementations



Classes
-------

.. autoapisummary::

   gnn_tracking.models.mlp.MLP
   gnn_tracking.models.mlp.ResFCNN
   gnn_tracking.models.mlp.HeterogeneousResFCNN
   gnn_tracking.models.mlp.ResMLP


Functions
---------

.. autoapisummary::

   gnn_tracking.models.mlp.get_pixel_mask


Module Contents
---------------

.. py:class:: MLP(input_size: int, output_size: int, hidden_dim: int | None, L=3, *, bias=True, include_last_activation=False)

   Bases: :py:obj:`torch.nn.Module`


   Multi Layer Perceptron, using ReLu as activation function.

   :param input_size: Input feature dimension
   :param output_size: Output feature dimension
   :param hidden_dim: Feature dimension of the hidden layers. If None: Choose maximum
                      of input/output size
   :param L: Total number of layers (1 initial layer, L-2 hidden layers, 1 output
             layer)
   :param bias: Include bias in linear layer?
   :param include_last_activation: Include activation function for the last layer?


   .. py:attribute:: layers


   .. py:method:: reset_parameters()


   .. py:method:: forward(x)


.. py:class:: ResFCNN(*, in_dim: int, hidden_dim: int, out_dim: int, depth: int, alpha: float = 0.6, bias: bool = True)

   Bases: :py:obj:`torch.nn.Module`


   Fully connected NN with residual connections.

   :param in_dim: Input dimension
   :param hidden_dim: Hidden dimension
   :param out_dim: Output dimension = embedding space
   :param depth: 1 input encoder layer, `depth-1` hidden layers, 1 output encoder layer
   :param alpha: strength of the residual connection


   .. py:attribute:: _encoder


   .. py:attribute:: _decoder


   .. py:attribute:: _layers


   .. py:attribute:: _alpha
      :value: 0.6



   .. py:method:: _reset_layer_parameters(layer, var: float)
      :staticmethod:



   .. py:method:: forward(x: torch.Tensor, **ignore) -> torch.Tensor


.. py:function:: get_pixel_mask(layer: torch.Tensor) -> torch.Tensor

.. py:class:: HeterogeneousResFCNN(*, in_dim: int, out_dim: int, hidden_dim: int, depth: int, alpha: float = 0.6, bias: bool = True)

   Bases: :py:obj:`torch.nn.Module`


   Separate FCNNs for pixel and strip data, with residual connections.
   For parameters, see `ResFCNN`.


   .. py:attribute:: pixel_fcnn


   .. py:attribute:: strip_fcnn


   .. py:method:: forward(x: torch.Tensor, layer: torch.Tensor) -> torch.Tensor


.. py:class:: ResMLP(in_dim: int, out_dim: int, hidden_dim: int, depth: int = 4, beta: float = 1.0, gamma_0: float = 1.0, eta_0: float = 0.01, activation: torch.nn.Module = Tanh, optimizer: str = 'adam', bias: bool = True, **kwargs)

   Bases: :py:obj:`torch.nn.Module`


   Fully connected NN w/ residual connections and Gaussian init
   Args:
   in_dim: input dimension
   out_dim: output dimension
   width: # neurons per internal layer
   beta: strength of the residual connection
   gamma_0: tuning of final layer output normalisation
   depth: number of hidden layers


   .. py:attribute:: layers


   .. py:attribute:: in_dim


   .. py:attribute:: out_dim


   .. py:attribute:: width


   .. py:attribute:: beta
      :value: 1.0



   .. py:attribute:: gamma_0
      :value: 1.0



   .. py:attribute:: eta_0
      :value: 0.01



   .. py:attribute:: gamma


   .. py:attribute:: depth
      :value: 4



   .. py:attribute:: act


   .. py:attribute:: lr


   .. py:method:: reset_parameters()


   .. py:method:: get_lr(optimizer)


   .. py:method:: forward(x)


