Squeeze#
- class bayesflow.adapters.transforms.Squeeze(*, axis: int | Sequence[int])[source]#
Bases:
ElementwiseTransform
Squeeze dimensions of an array.
- Parameters:
- axisint or tuple
The axis to squeeze. As the number of batch dimensions might change, we advise using negative numbers (i.e., indexing from the end instead of the start).
Examples
shape (3, 1) array:
>>> a = np.array([[1], [2], [3]])
>>> sq = bf.adapters.transforms.Squeeze(axis=-1) >>> sq.forward(a).shape (3,)
It is recommended to precede this transform with a
ToArray
transform.