Skip to content
class

StackTransform

extendsTransform
StackTransform(transforms: list[Transform], dim: int = 0)

Apply a list of transforms to indexed slices along a stack axis.

The kk-th transform is applied to the kk-th slice obtained by Tensor.unbind along dim, and the results are stacked back along the same axis. This is the heterogeneous counterpart of IndependentTransform: different bijections can be applied to different coordinates of an event vector.

Parameters

transformslist[Transform]
One transform per slice. Must be non-empty and the same length as x.shape[dim].
dimint= 0
Dimension along which to slice. Default 0.

Raises

ValueError
If transforms is empty, or if the size of dim does not match len(transforms) at call time.

Used by 1

Constructors

1
dunder

__init__

→None
__init__(transforms: list[Transform], dim: int = 0)

Store the per-slice transforms and the stacking axis dim.

Properties

2
prop

codomain

→Constraint
codomain: Constraint

Stacked codomain constraint across all slice transforms.

prop

domain

→Constraint
domain: Constraint

Stacked domain constraint across all slice transforms.

Instance methods

1
fn

log_abs_det_jacobian

→Tensor
log_abs_det_jacobian(x: Tensor, y: Tensor)

Per-slice Jacobians stacked back along dim.