For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python function
side_stream
side_stream()
max.graph.ops.sequence.side_stream(inputs, body_fn, *, result_types, stream_id=1)
Run a block of ops on a side device stream via mo.sequence.
The body executes on the device stream selected by stream_id (0 is the
default stream), overlapping independent work on the main stream. Inputs map
1:1 to the body’s block arguments and the body returns one value per
result_types entry. The graph compiler binds the whole body to a
side-stream device-context view and inserts the cross-stream synchronization
at the boundary, so callers never manage streams or events directly.
-
Parameters:
-
- inputs (Sequence[Value[TensorType] | TensorValue | Shape | Dim | HasTensorValue | int | float | integer[Any] | floating[Any] | DLPackArray]) – Values passed into the body, mapped 1:1 to block arguments.
- body_fn (Callable[[...], TensorValue | Iterable[TensorValue]]) – Callable receiving one value per input and returning one value
per
result_typesentry. - result_types (Sequence[TensorType]) – The body’s output types (one per result).
- stream_id (int) – Device stream to run the body on (0 is the default stream).
-
Returns:
-
One
TensorValueperresult_typesentry. -
Return type: