Sequential Strategy¤
Chain operators to execute one after another.
See Also¤
- Operators Overview - All operator types
- Composite Operator - Operator composition
- Parallel Strategy - Parallel execution
- Pipeline Tutorial
datarax.operators.strategies.sequential ¤
Sequential composition strategies.
SequentialStrategy ¤
Bases: CompositionStrategyImpl
Applies operators in sequence (chain).
apply ¤
apply(operators: list[OperatorModule], context: StrategyContext) -> tuple[PyTree, PyTree, dict[str, Any]]
Apply operators sequentially, piping each output to the next.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operators
|
list[OperatorModule]
|
Ordered list of operators to chain. |
required |
context
|
StrategyContext
|
Execution context with input data, state, and RNG params. |
required |
Returns:
| Type | Description |
|---|---|
tuple[PyTree, PyTree, dict[str, Any]]
|
Tuple of (data, state, metadata) after all operators have run. |
ConditionalSequentialStrategy ¤
Bases: CompositionStrategyImpl
Applies operators sequentially with conditions.
Only applies operators where condition evaluates to True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conditions
|
Sequence[Callable[[PyTree], bool | Array]]
|
List of callables that determine whether each operator is applied. |
required |
apply ¤
apply(operators: list[OperatorModule], context: StrategyContext) -> tuple[PyTree, PyTree, dict[str, Any]]
Apply operators sequentially, skipping those whose condition is False.
Uses jax.lax.cond for vmap-compatible conditional execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operators
|
list[OperatorModule]
|
Operators to apply (must match length of conditions). |
required |
context
|
StrategyContext
|
Execution context with input data, state, and RNG params. |
required |
Returns:
| Type | Description |
|---|---|
tuple[PyTree, PyTree, dict[str, Any]]
|
Tuple of (data, state, metadata) after conditional execution. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If operator count doesn't match condition count. |