Batch operations

class morphocut.batch.Batch[source]

Special sequence type that is recognized by BatchPipeline.

class morphocut.batch.BatchedPipeline(batch_size, *, parent=None, groupby=None)[source]

Combine consecutive objects into a batch.

Example

with Pipeline() as p:
    # a is a scalar
    a = ...
    with BatchedPipeline():
        # a is a sequence
        ...

    # a is a scalar again
transform_stream(stream=None)[source]

Run the stream through all nodes and return it.

Parameters

stream – A stream to transform. This argument is solely to be used internally.

Returns

Stream – An iterable of stream objects.