models module

class models.AudioVAE(imgChannels=1, featureDim=15656, zDim=256)[source]

Bases: Module, Generator

A simple naive try at creating and Audio VAE for Generative Replay.

Attention

This doesn’t work really well, because of the poor generative capabilities of this model.

decoder(z)[source]
encoder(x)[source]
forward(x)[source]

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

generate(batch_size=None, condition=None)[source]

Lets the generator sample random samples. Output is either a single sample or, if provided, a batch of samples of size “batch_size”

Parameters:
  • batch_size – Number of samples to generate

  • condition – Possible condition for a condotional generator (e.g. a class label)

reparameterize(mu, logVar)[source]
class models.Circularize[source]

Bases: Module

A try at circularizing the latent space before LDA

Note

We got 1% less accuracy than regular LDA.

forward(x)[source]

Defines 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 models.EncDecBaseModel(num_mels, final_filter, num_classes, input_length)[source]

Bases: Module

Encoder decoder model for MatchboxNet from the paper : http://arxiv.org/abs/2004.08531

Parameters:
  • num_mels (int) – number of mel features in the mfcc transform preprocessing

  • final_filter (int) – size of final conv filter in the encoder

  • num_classes (int) – number of output classes for classification

  • input_length (int) – input time dimension length

forward(input_signal)[source]

Defines 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 models.M5(n_input=1, n_output=35, stride=16, n_channel=32)[source]

Bases: Module

Basic M5 model from the paper https://arxiv.org/pdf/1610.00087.pdf

Parameters:
  • n_input (int, optional) – Number of inputs. Defaults to 1.

  • n_output (int, optional) – Number of outputs. Defaults to 35.

  • stride (int, optional) – Convolution stride. Defaults to 16.

  • n_channel (int, optional) – Output channels of convolution layers. Defaults to 32.

forward(x)[source]

Defines 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 models.Pool(channel_size)[source]

Bases: Module

A simple pooling model to add at the end of a feature extractor

forward(x)[source]

Defines 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 models.Scattering_Classifier[source]

Bases: Module

A try at directly classifying using a simple scattering classifier without a CNN.

forward(x)[source]

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