current_stream

paddle.device.cuda. current_stream ( device=None ) [source]

Warning

API “paddle.device.cuda.current_stream” is deprecated since 2.5.0, and will be removed in future versions. Please use “paddle.device.current_stream” instead. Reason: current_stream in paddle.device.cuda will be removed in future

Return the current CUDA stream by the device.

Parameters

device (paddle.CUDAPlace()|int, optional) – The device or the ID of the device which want to get stream from. If device is None, the device is the current device. Default: None.

Returns

the stream to the device.

Return type

CUDAStream

Examples

>>> 
>>> import paddle
>>> paddle.device.set_device('gpu')

>>> s1 = paddle.device.cuda.current_stream()

>>> s2 = paddle.device.cuda.current_stream(0)

>>> s3 = paddle.device.cuda.current_stream(paddle.CUDAPlace(0))