pyFDN.Response#

class pyFDN.Response(h, fs)[source]#

The impulse response of an FDN, as a loss sees it.

Variables:
  • h (torch.Tensor) – Impulse response of shape (n_samples, n_out, n_in) – the same convention as pyFDN.build_to_impz(). This is the response itself: any anti-aliasing envelope the model was built with has already been removed by the shell’s output layer, so h is accurate to alias_decay_db (see pyFDN.trainable_from_build()) and needs no further correction. Differentiable during training.

  • fs (float) – Sample rate in Hz.

__init__(h, fs)#

Methods

__init__(h, fs)

flamo_layout()

h permuted to FLAMO's (batch, n_samples, n_out) layout.

Attributes

magnitude

|spectrum|, shape (n_samples // 2 + 1, n_out, n_in).

n_in

n_out

n_samples

spectrum

rfft(h) over time -- shape (n_samples // 2 + 1, n_out, n_in).

h

fs

flamo_layout()[source]#

h permuted to FLAMO’s (batch, n_samples, n_out) layout.

FLAMO’s loss functions take a batched time signal whose batch axis is the excited input, which is exactly h’s input axis moved to front.

Return type:

Tensor

fs: float#
h: Tensor#
property magnitude: Tensor[source]#

|spectrum|, shape (n_samples // 2 + 1, n_out, n_in).

property n_in: int#
property n_out: int#
property n_samples: int#
property spectrum: Tensor[source]#

rfft(h) over time – shape (n_samples // 2 + 1, n_out, n_in).

The DFT of the truncated impulse response, i.e. of h under a rectangular window of n_samples. Computed once per response and shared by every loss that asks for it.