Context-manager that changes the selected device.
System Message: ERROR/3 (/usr/local/lib/python3.10/site-packages/paddle/device/__init__.py:docstring of paddle.device.device, line 2)
Error in “code-block” directive: maximum 1 argument(s) allowed, 4 supplied.
.. code-block:: python
>>> import paddle
>>> print(paddle.device.get_device()) # gpu:0
>>> with paddle.device.device("cpu"):
... print(paddle.device.get_device()) # cpu
>>> # paddle.cuda.device is an alias of paddle.device.device
>>> with paddle.cuda.device("cpu"):
... print(paddle.device.get_device()) # cpu
>>> print(paddle.device.get_device())