torch.cuda.get_stream_from_external — PyTorch 2.7 documentation (original) (raw)

torch.cuda.get_stream_from_external(data_ptr, device=None)[source][source]

Return a Stream from an externally allocated CUDA stream.

This function is used to wrap streams allocated in other libraries in order to facilitate data exchange and multi-library interactions.

Note

This function doesn’t manage the stream life-cycle, it is the user responsibility to keep the referenced stream alive while this returned stream is being used.

Parameters

Return type

Stream