class
ReplayCompose
extends
_ContainerReplayCompose(transforms: list[TransformLike], p: float = 1.0)Compose that records applied params for deterministic replay.
After a call, replay_data holds (transform, params, applied)
per child; replay re-applies the same params to a new
sample (e.g. to apply an identical augmentation to a paired input).
Parameters
pfloat= 1.0Probability of applying the transform; otherwise the input
passes through unchanged.
Examples
Records what it sampled, so the same random transform can be applied
again — to a second view, or to a mask that arrived later:
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.ReplayCompose([T.RandomCrop(16, 16), T.HorizontalFlip(p=0.5)])
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 16, 16)Used by 1
Constructors
2Instance methods
1Re-apply a previously recorded replay_data to a new sample.
Walks the saved (transform, params, applied) log in order
and dispatches each Transform with its original
sampled params (no fresh sampling). Raw callables are
re-invoked without parameters. Records marked applied=False
are skipped, preserving the original gate decisions.
Parameters
savedlist of (TransformLike, object, bool)Trace produced by an earlier
__call__; usually
other_compose.replay_data.inputsobjectSample to feed through the replayed pipeline.
Returns
objectThe replayed output, structurally matching inputs.