Shortcuts

asteroid.filterbanks.enc_dec module

class asteroid.filterbanks.enc_dec.Decoder(filterbank, is_pinv=False, padding=0, output_padding=0)[source]

Bases: asteroid.filterbanks.enc_dec._EncDec

Decoder class.

Add decoding methods to Filterbank classes. Not intended to be subclassed.

Parameters:
  • filterbank (Filterbank) – The filterbank to use as an decoder.
  • is_pinv (bool) – Whether to be the pseudo inverse of filterbank.
  • padding (int) – Zero-padding added to both sides of the input.
  • output_padding (int) – Additional size added to one side of the output shape.
Notes
padding and output_padding arguments are directly passed to F.conv_transpose1d.
forward(spec)[source]

Applies transposed convolution to a TF representation.

This is equivalent to overlap-add.

Parameters:spec (torch.Tensor) – 3D or 4D Tensor. The TF representation. (Output of Encoder.forward()).
Returns:torch.Tensor – The corresponding time domain signal.
classmethod pinv_of(filterbank)[source]

Returns an Decoder, pseudo inverse of a filterbank or Encoder.

class asteroid.filterbanks.enc_dec.Encoder(filterbank, is_pinv=False, as_conv1d=True, padding=0)[source]

Bases: asteroid.filterbanks.enc_dec._EncDec

Encoder class.

Add encoding methods to Filterbank classes. Not intended to be subclassed.

Parameters:
  • filterbank (Filterbank) – The filterbank to use as an encoder.
  • is_pinv (bool) – Whether to be the pseudo inverse of filterbank.
  • as_conv1d (bool) – Whether to behave like nn.Conv1d. If True (default), forwarding input with shape (batch, 1, time) will output a tensor of shape (batch, freq, conv_time). If False, will output a tensor of shape (batch, 1, freq, conv_time).
  • padding (int) – Zero-padding added to both sides of the input.
batch_1d_conv(inp, filters)[source]
forward(waveform)[source]

Convolve input waveform with the filters from a filterbank. :param waveform: any tensor with samples along the

last dimension. The waveform representation with and batch/channel etc.. dimension.
Returns:torch.Tensor – The corresponding TF domain signal.
Shapes:
>>> (time, ) --> (freq, conv_time)
>>> (batch, time) --> (batch, freq, conv_time)  # Avoid
>>> if as_conv1d:
>>>     (batch, 1, time) --> (batch, freq, conv_time)
>>>     (batch, chan, time) --> (batch, chan, freq, conv_time)
>>> else:
>>>     (batch, chan, time) --> (batch, chan, freq, conv_time)
>>> (batch, any, dim, time) --> (batch, any, dim, freq, conv_time)
classmethod pinv_of(filterbank, **kwargs)[source]

Returns an Encoder, pseudo inverse of a Filterbank or Decoder.

class asteroid.filterbanks.enc_dec.Filterbank(n_filters, kernel_size, stride=None)[source]

Bases: sphinx.ext.autodoc.importer._MockObject

Base Filterbank class. Each subclass has to implement a filters property.

Parameters:
  • n_filters (int) – Number of filters.
  • kernel_size (int) – Length of the filters.
  • stride (int, optional) – Stride of the conv or transposed conv. (Hop size). If None (default), set to kernel_size // 2.
Variables:

n_feats_out (int) – Number of output filters.

get_config()[source]

Returns dictionary of arguments to re-instantiate the class.

filters

Abstract method for filters.

Read the Docs v: v0.3.3
Versions
latest
stable
v0.3.3
v0.3.2
v0.3.1
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.