Data representations
The Python data types blocks receive at runtime: Batch, WorkflowImageData, and VideoMetadata.
Batch
from inference.core.workflows.execution_engine.entities.base import Batch
from inference.core.workflows.prototypes.block import BlockResult
# run method of Workflow block
def run(self, x: Batch[int], y: Batch[float]) -> BlockResult:
passIteration through elements
from inference.core.workflows.execution_engine.entities.base import Batch
def iterate(batch: Batch[int]) -> None:
for element in batch:
print(element)Zipping multiple batches
Getting batch element indices
Iterating while retrieving both elements and their indices
Additional methods of Batch container
WorkflowImageData
VideoMetadata
Last updated
Was this helpful?