# tensorplay.cuda.set_device

Source: https://www.tensorplay.cn/docs/generated/tensorplay.cuda.set_device.html

# tensorplay.cuda.set_device

tensorplay.cuda.set_device(device: [Any](https://docs.python.org/3/library/typing.html#typing.Any)) &#x2192; [None](https://docs.python.org/3/library/constants.html#None)[[source]](../_modules/tensorplay/cuda.html#set_device)

Set the current device.

Usage of this function is discouraged in favor of [device](tensorplay.cuda.device.html#tensorplay.cuda.device). In most
cases it’s better to use CUDA_VISIBLE_DEVICES environmental variable.

Parameters:

device ([tensorplay.Device](tensorplay.Device.html#tensorplay.Device) or [int](https://docs.python.org/3/library/functions.html#int)) – selected device. This function is a no-op
if this argument is negative.
