grelu.model.trunks.explainn#

Classes#

ExplaiNNConvBlock

Convolutional block for the ExplaiNN model.

ExplaiNNTrunk

The ExplaiNN model architecture.

Module Contents#

class grelu.model.trunks.explainn.ExplaiNNConvBlock(in_channels: int, out_channels: int, kernel_size: int, groups: int, act_func: str, dropout: float)[source]#

Bases: torch.nn.Module

Convolutional block for the ExplaiNN model.

forward(x: torch.Tensor) torch.Tensor[source]#

Forward pass

Parameters:

x – Input tensor of shape (N, C, L)

Returns:

Output tensor

class grelu.model.trunks.explainn.ExplaiNNTrunk(in_len: int, channels=300, kernel_size=19)[source]#

Bases: torch.nn.Module

The ExplaiNN model architecture.

Parameters:
  • n_tasks (int) – number of outputs

  • input_length (int) – length of the input sequences

  • channels (int) – number of independent CNN units (default=300)

  • kernel_size (int) – size of each unit’s conv. filter (default=19)

forward(x: torch.Tensor) torch.Tensor[source]#

Forward pass

Parameters:

x – Input tensor of shape (N, C, L)

Returns:

Output tensor