fishy.models.deep.wavenet

WaveNet model for spectral classification.

Classes

class fishy.models.deep.wavenet.CausalConv1d(in_channels: int, out_channels: int, kernel_size: int, dilation: int = 1, **kwargs)[source]

Bases: Module

__init__(in_channels: int, out_channels: int, kernel_size: int, dilation: int = 1, **kwargs) None[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) Tensor[source]

Define 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.

class fishy.models.deep.wavenet.ResidualBlock(channels: int, kernel_size: int, dilation: int, dropout: float = 0.2)[source]

Bases: Module

__init__(channels: int, kernel_size: int, dilation: int, dropout: float = 0.2) None[source]

Initialize internal Module state, shared by both nn.Module and ScriptModule.

forward(x: Tensor) Tensor[source]

Define 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.

class fishy.models.deep.wavenet.WaveNet(input_dim: int, output_dim: int, hidden_dim: int = 128, num_layers: int = 4, dropout: float = 0.2, kernel_size: int = 3, **kwargs)[source]

Bases: Module

WaveNet-based model for spectral data classification.

__init__(input_dim: int, output_dim: int, hidden_dim: int = 128, num_layers: int = 4, dropout: float = 0.2, kernel_size: int = 3, **kwargs) None[source]

Initializes the WaveNet model.

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

  • output_dim (int) – Number of output classes.

  • hidden_dim (int, optional) – Hidden dimension. Defaults to 128.

  • num_layers (int, optional) – Number of residual blocks. Defaults to 4.

  • dropout (float, optional) – Dropout rate. Defaults to 0.2.

  • kernel_size (int, optional) – Kernel size. Defaults to 3.

forward(x: Tensor) Tensor[source]

Define 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.

s