albumentations.core.invocation


Call-local execution state for transforms and composition containers.

InvocationOwnerclass

InvocationOwner()

Defines an identity for call-local sampling and processor state. It keeps transient execution values off the reusable configured graph node that owns this key.

InvocationRngOwnerclass

InvocationRngOwner()

Owns configured seed sources for transforms and Compose nodes. It resolves thread-local streams without retaining generators that belong to active calls. A configured object owns the source pair for its configuring thread and derives one private pair for every other execution thread. An :class:`InvocationContext` only resolves the source for the active call; it never stores an active generator on the configured object.

TransformInvocationStateclass

TransformInvocationState()

Stores parameters and realized configuration from one transform call. It keeps replay and observation data off the configured transform object.

ComposeInvocationStateclass

ComposeInvocationState()

Stores grayscale normalization and instance-binding details for one Compose call. It prevents temporary target metadata from leaking into another sample.

InvocationObservationclass

InvocationObservation()

Keeps caller-local snapshots from an observing call, exposing detached parameters without retaining configured transforms or shared state.

InvocationContextclass

InvocationContext()

Owns mutable state for one augmentation call, including streams, parameters, target sessions, and normalization decisions. Configured graphs remain reusable. The context contains the root random streams, per-transform sampled values, cloned target processors, and normalization state. Configured Compose and BasicTransform objects remain reusable across calls.

SamplingContextclass

SamplingContext()

Carry one invocation's random streams and realized-policy sink, so samplers receive call-local state explicitly instead of reading a reusable configured object.

get_current_invocationfunction

get_current_invocation()

Returns the invocation active in this thread or task, letting transform RNG and state access resolve call-local values without configured-object mutation.

get_completed_transform_statefunction

get_completed_transform_state(
    transform: InvocationOwner
)

Returns detached state from the caller's recent observing root call. Ordinary Compose execution intentionally discards observation data and returns no state.

Parameters

NameTypeDefaultDescription
transformInvocationOwner--

publish_completed_transform_statefunction

publish_completed_transform_state(
    transform: InvocationOwner,
    state: TransformInvocationState
)

Publishes a direct deterministic leaf's caller-local result after application without activating a full execution context when no state is read during dispatch. The fast path has no sampler, configured processors, or dynamic random access, so the state is already isolated in the synchronous direct call and can be published only after it returns.

Parameters

NameTypeDefaultDescription
transformInvocationOwner--
stateTransformInvocationState--

clear_completed_observationfunction

clear_completed_observation()

Clears this caller's observation after a non-observing root call, so child parameter access never describes an earlier sample instead of the latest result.