src.model.extras

Submodules

src.model.extras.example_module

class src.model.extras.example_module.ExampleModule[source]

Bases: torch.nn.modules.module.Module

An example of a user-defined module that is passed to SeparationModel for building up the model. This should be imported explicitly in the init to be included.

Now that it’s defined here, it can be used in your model configuration like so:

model_config:
 class: SeparationModel
 modules:
     log_spectrogram
     example_module:
       class: ExampleModule
       args:
 connections:
     - !!python/tuple      # tuple containing two things:
       - example_module    # unique name given to module above
       - [log_spectrogram] # list of runtime arguments needed by that module
                         # (e.g. output of prev layer)
 output:
 - example_module
forward(data)[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.

Module contents