transforms module

Abstract definition of invertible transforms for coupling cells

class InvertibleTransform(*args, **kwargs)[source]

Bases: better_abc.ABC

Callable invertible transform which calls self.forward or self.backward depending on self.inverse

inverse[source]

whether calling the object will use the forward or backward transform

Type

bool

Constructor for InvertibleTransform

No arguments, no returns, this is just encapsulation for a function and its inverse

abstract backward(y, T, compute_jacobian=True)[source]

Abstract backward transform

Parameters
  • y (torch.Tensor) – batch of points to transform

  • T (torch.Tensor) – batch of parameters for the transformation

  • compute_jacobian (bool) – whether to compute the jacobian or not

Returns

(z,j) where the first tensor is the batch of transformed points and the second is the batch of jacobians

Return type

tuple of torch.Tensor, torch.Tensor

abstract forward(y, T, compute_jacobian=True)[source]

Abstract forward transform

Parameters
  • y (torch.Tensor) – batch of points to transform

  • T (torch.Tensor) – batch of parameters for the transformation

  • compute_jacobian (bool) – whether to compute the jacobian or not

Returns

(z,j) where the first tensor is the batch of transformed points and the second is the batch of jacobians

Return type

tuple of torch.Tensor, torch.Tensor

invert()[source]

Flip the inverse attribute

Returns

Return type

None