class
Compose
extends
_NoParamsTransform[Empty]Compose(transforms: list[TransformLike], bbox_params: BboxParams | None = None)Chain transforms into one callable (works on tensors or samples).
Parameters
transformslist of TransformApplied left-to-right; each transform's output feeds the next.
When given, bounding boxes are filtered after the pipeline by
min_area / min_visibility (degenerate boxes that left the
frame are dropped, along with their labels).Examples
>>> from lucid.utils.transforms import Compose, Resize, CenterCrop, Normalize
>>> tf = Compose([
... Resize(256, 256),
... CenterCrop(224, 224),
... Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225),
... max_pixel_value=1.0),
... ])
>>> y = tf(image)Used by 2
Constructors
2dunder
__init__
→None__init__(transforms: list[TransformLike], bbox_params: BboxParams | None = None)Initialise the driver; the executable itself is lazy.
Parameters
modelSee
fused_step for semantics.loss_fnSee
fused_step for semantics.optimizerSee
fused_step for semantics.grad_scalerGradScalerSee
fused_step. When provided and enabled, the
trace records the scale → unscale → found_inf → conditional
update plumbing entirely inside the executable so the
user-facing step is identical to a no-scaler call.Raises
ValueErrorIf
optimizer exposes no trainable parameters (every
param_group is empty).Run one fused training step; lazy-compile on first call.
Parameters
*argsTensor(model_input, *loss_targets) — same positional tuple
that loss_fn(model(input), *targets) would consume.Returns
TensorScalar loss tensor freshly allocated for this step. All parameter and optimizer-state buffers have already been updated in-place before this returns.