Channels

Linear channel

class tramp.channels.LinearChannel(W, precompute_svd=True, name='W')[source]

Linear channel x = W z.

Parameters
  • W (-) –

  • precompute_svd (-) – if True precompute SVD of W = U S V.T

  • name (-) – name of weight matrix W for display

class tramp.channels.ComplexLinearChannel(W, precompute_svd=True, name='W')[source]

Complex linear channel x = W z.

Parameters
  • W (-) –

  • precompute_svd (-) – if True precompute SVD of W = U S V.conj().T

  • name (-) – name of weight matrix W for display

Notes

For message passing it is more convenient to represent a complex array x as a real array X where X[0] = x.real and X[1] = x.imag

In particular: - input of sample(): Z array of shape (2, z.shape) - output of sample(): X array of shape (2, x.shape) - message bz, posterior rz: real arrays of shape (2, z.shape) - message bx, posterior rx: real arrays of shape (2, x.shape)

class tramp.channels.AnalyticalLinearChannel(ensemble, name='W')[source]
class tramp.channels.MarchenkoPasturChannel(alpha, name='W')[source]
class tramp.channels.DFTChannel(real=True)[source]

Discrete fourier transform x = FFT z.

Parameters

real (-) – If z supposed to be real

Notes

The fft and ifft are scaled by sqrt(N) so that both are unitary.

For message passing it is more convenient to represent a complex array x as a real array X where X[0] = x.real and X[1] = x.imag

In particular: - output of sample(): X array of shape (2, x.shape) - message bx, posterior rx: real arrays of shape (2, x.shape)

And if real=False (z complex):
  • input of sample(): Z array of shape (2, z.shape)

  • message bz, posterior rz: real arrays of shape (2, z.shape)

Examples using tramp.channels.DFTChannel

class tramp.channels.ConvChannel(filter, real=True)[source]

Conv (complex or real) channel x = w * z.

Parameters
  • filter (-) – Filter weights. The conv weights w are given by w[u] = f*[-u]. The conv and filter weights ffts are conjugate.

  • real (-) – if True assume x, w, z real if False assume x, w, z complex

Notes

For message passing it is more convenient to represent a complex array x as a real array X where X[0] = x.real and X[1] = x.imag

In particular when real=False (x, w, z complex): - input of sample(): Z real array of shape (2, z.shape) - output of sample(): X real array of shape (2, x.shape) - message bz, posterior rz: real arrays of shape (2, z.shape) - message bx, posterior rx: real arrays of shape (2, x.shape)

class tramp.channels.Blur1DChannel(sigma, N, real=True)[source]
class tramp.channels.Blur2DChannel(sigma, shape, real=True)[source]
class tramp.channels.DifferentialChannel(D1, D2, shape, real=True)[source]
class tramp.channels.LaplacianChannel(shape, real=True)[source]
class tramp.channels.GradientChannel(shape, real=True)[source]

Gradient channel x = grad z

Examples using tramp.channels.GradientChannel

class tramp.channels.UnitaryChannel(U, name='U')[source]

Unitary channel x = U z.

Parameters
  • U (-) –

  • name (-) – name of unitary matrix U for display

Notes

For message passing it is more convenient to represent a complex array x as a real array X where X[0] = x.real and X[1] = x.imag

In particular: - input of sample(): Z array of shape (2, z.shape) - output of sample(): X array of shape (2, x.shape) - message bz, posterior rz: real arrays of shape (2, z.shape) - message bx, posterior rx: real arrays of shape (2, x.shape)

class tramp.channels.RotationChannel(R, name='R')[source]

Piecewise linear activation

class tramp.channels.SgnChannel[source]
class tramp.channels.AbsChannel[source]
class tramp.channels.AsymmetricAbsChannel(shift=0.0001)[source]
class tramp.channels.ReluChannel[source]
class tramp.channels.LeakyReluChannel(slope)[source]
class tramp.channels.HardTanhChannel[source]
class tramp.channels.HardSigmoidChannel[source]
class tramp.channels.SymmetricDoorChannel(width)[source]

Others

class tramp.channels.GaussianChannel(var=1)[source]
class tramp.channels.ModulusChannel[source]

Modulus channel \(x = |z|\).

Notes

For message passing it is more convenient to represent a complex array x as a real array X where X[0] = x.real and X[1] = x.imag

In particular: - input of sample(): Z array of shape (2, z.shape) - message bz, posterior rz: real arrays of shape (2, z.shape)

class tramp.channels.BiasChannel(bias)[source]
class tramp.channels.SumChannel(n_prev)[source]
class tramp.channels.ReshapeChannel(prev_shape, next_shape)[source]

Reshape array

Parameters
  • next_shape (-) –

  • prev_shape (-) –

class tramp.channels.DuplicateChannel(n_next)[source]
class tramp.channels.ConcatChannel(Ns, axis=0)[source]