repeat_and_flatten#
- bayesflow.utils.repeat_and_flatten(x: Tensor, num_repeats: int) Tensor[source]#
Repeat each element along the leading (batch) axis and flatten back into it.
Inserts a new axis after the batch axis, tiles it
num_repeatstimes and merges it back, so(B, ...) -> (B * num_repeats, ...)with repeats of the same element kept adjacent (ordering[x0, x0, ..., x1, x1, ...]).