Flip around a random axis (Albumentations Flip).
Samples code ∈ {0 (vertical), 1 (horizontal), -1 (both)}.
Parameters
pfloat= 1.0Probability of applying the transform; otherwise the input
passes through unchanged.
Examples
>>> import lucid, lucid.utils.transforms as T
>>> tf = T.Flip(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)Used by 1
Constructors
1Wrap model for cached graph-capture execution.
Parameters
modelnn.Module or _CallableModuleThe compute unit to compile. Stored unwrapped so
attribute access falls through to it.
dynamicboolDeclare that this module will be called with varying batch
sizes. Default
False. Variable batch is always handled by
per-shape static caching — each distinct input shape compiles its
own executable, cached and reused — which works for every model and
never recompiles for a shape already seen. A single executable
shared across batch sizes (a symbolic batch axis) is not offered
automatically: Apple's MPSGraph aborts (uncatchably) the moment a
graph materialises a constant carrying the symbolic axis — scalar
arithmetic (x * 0.5), reshape / flatten, reductions,
convolutions and attention all trip it, i.e. essentially every real
model. The narrow class that is safe (pure linear /
activation / softmax / layer_norm / embedding graphs) can
opt in to the experimental symbolic path with the
LUCID_COMPILE_DYNAMIC=1 environment variable; without it
dynamic=True is exactly the safe per-shape static behaviour.