tfep.nn.transformers.affine.volume_preserving_shift_transformer

tfep.nn.transformers.affine.volume_preserving_shift_transformer(x, shift, periodic_indices=None, periodic_limits=None)[source]

Implement a volume-preserving transformer for autoregressive normalizing flows.

This provides a functional API to the VolumePreservingShiftTransformer layer. It implements the transformation

\(y_i = x_i + b_i\)

where \(b_i\) is the shift parameter of the transformation that are usually generated by a conditioner.

The function returns the transformed feature as a Tensor of shape (batch_size, n_features) and the log absolute determinant of its Jacobian (always a zero vector) as a Tensor of shape (batch_size,).

Parameters:
  • x (torch.Tensor) – Input tensor x of shape (batch_size, n_features).

  • shift (torch.Tensor) – The shift coefficients of shape (batch_size, n_features) (i.e. the b coefficients).

  • periodic_indices (torch.Tensor, optional) – If provided, the features indexed by periodic_indices will be treated as periodic with period periodic_limits.

  • periodic_limits (torch.Tensor, optional) – The period of periodic features.

Returns:

  • y (torch.Tensor) – Output tensor of shape (batch_size, n_features).

  • log_det_J (torch.Tensor) – The logarithm of the absolute value of the determinant of the Jacobian of the transformation (always zero) with shape (batch_size,).

See also

VolumePreservingShiftTransformer

Object-oriented API for the transformer.