Stream
_class _Stream(auto_yield : bool = True)
Represents a stream that is used by the module for inference.
Notes
When creating a Stream object, the actual stream is not instantiated immediately. This object is initialized only when tcim_lite.runtime.Module.set_stream() is called with the Stream object. This deferred instantiation allows for more efficient resource allocation during the model loading process.
Examples
import tcim_lite as tcim
# Create a stream and set the stream to the module
stream = tcim.runtime.Stream()
module.set_stream(stream)
# Synchronize the stream
stream.sync()
# Sync and yield the stream (for Houmo M30 products only)
stream.sync_yield()
# Destroy the stream immediately, it can also be destroyed automatically
del stream
Constructor for the Stream class.
Parameters:
auto_yield (bool) -- Specifies if to automatically release IPU core resources after all tasks in the stream are completed. Defaults to True. This parameter is only applicable to Houmo M30 products. For Houmo M50 products, the value is always True.
Methods
__init__ | Constructor for the Stream class. |
|---|---|
sync | Waits for all tasks in the stream to complete. |
sync_yield | Releases the IPU core resources that is used by the stream. |