current_stream

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

Return the current stream by the device. :param device: The device which want to get stream from. If device is None, the device is the current device. Default: None.

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.current_stream, line 3)

Unexpected indentation.

It can be gpu, gpu:x,``custom_device``, custom_device:x, where custom_device is the name of CustomDevicec, where x is the index of the GPUs, CustomDevicecs. And it can be paddle.CUDAPlace(n) or paddle.CustomPlace(n).

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.current_stream, line 5)

Block quote ends without a blank line; unexpected unindent.

Returns

The stream to the device.

Return type

Stream

Examples

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/device/__init__.py:docstring of paddle.device.current_stream, line 12)

Error in “code-block” directive: maximum 1 argument(s) allowed, 6 supplied.

.. code-block:: python
    # required: custom_device
    import paddle

    paddle.set_device('custom_cpu')
    s1 = paddle.device.current_stream()
    s2 = paddle.device.current_stream("custom_cpu:0")
    place = paddle.CustomPlace('custom_cpu', 0)
    s3 = paddle.device.current_stream(place)